Lines Matching defs:obj

47 	local obj = parser:get_object()
48 local got = ucl.to_format(obj, 'json')
75 static int ucl_object_lua_push_array (lua_State *L, const ucl_object_t *obj);
76 static int ucl_object_lua_push_scalar (lua_State *L, const ucl_object_t *obj, bool allow_array);
86 * @param obj
90 const ucl_object_t *obj)
93 ucl_object_push_lua (L, obj, true);
136 * @param obj
140 ucl_object_lua_push_object (lua_State *L, const ucl_object_t *obj,
147 if (allow_array && obj->next != NULL) {
149 return ucl_object_lua_push_array (L, obj);
153 while (ucl_object_iterate (obj, &it, true) != NULL) {
160 while ((cur = ucl_object_iterate (obj, &it, true)) != NULL) {
170 * @param obj
174 ucl_object_lua_push_array (lua_State *L, const ucl_object_t *obj)
180 if (obj->type == UCL_ARRAY) {
181 nelt = obj->len;
182 it = ucl_object_iterate_new (obj);
193 LL_FOREACH (obj, cur) {
199 LL_FOREACH (obj, cur) {
213 ucl_object_lua_push_scalar (lua_State *L, const ucl_object_t *obj,
218 if (allow_array && obj->next != NULL) {
220 return ucl_object_lua_push_array (L, obj);
223 switch (obj->type) {
225 lua_pushboolean (L, ucl_obj_toboolean (obj));
228 lua_pushstring (L, ucl_obj_tostring (obj));
232 lua_pushinteger (L, ucl_obj_toint (obj));
234 lua_pushnumber (L, ucl_obj_toint (obj));
239 lua_pushnumber (L, ucl_obj_todouble (obj));
245 fd = (struct ucl_lua_funcdata *)obj->value.ud;
257 * @function ucl_object_push_lua(L, obj, allow_array)
259 * converts `obj` to lua representation using the following conversions:
267 * @param {ucl_object_t} obj object to push
272 ucl_object_push_lua (lua_State *L, const ucl_object_t *obj, bool allow_array)
274 switch (obj->type) {
276 return ucl_object_lua_push_object (L, obj, allow_array);
278 return ucl_object_lua_push_array (L, obj);
280 return ucl_object_lua_push_scalar (L, obj, allow_array);
293 ucl_object_t *obj, *top = NULL;
337 obj = ucl_object_lua_fromelt (L, lua_gettop (L));
338 if (obj != NULL) {
339 ucl_array_append (top, obj);
350 obj = ucl_object_lua_fromelt (L, lua_gettop (L));
352 if (obj != NULL) {
353 ucl_object_insert_key (top, obj, k, keylen, true);
363 * Get a single element from lua to object obj
365 * @param obj
373 ucl_object_t *obj = NULL;
380 obj = ucl_object_fromstring_common (lua_tostring (L, idx), 0, 0);
385 obj = ucl_object_fromint (num);
388 obj = ucl_object_fromdouble (num);
392 obj = ucl_object_frombool (lua_toboolean (L, idx));
396 obj = ucl_object_typed_new (UCL_NULL);
404 lua_settop (L, 3); /* gen, obj, func */
405 lua_insert (L, 1); /* func, gen, obj */
406 lua_insert (L, 2); /* func, obj, gen */
408 obj = ucl_object_lua_fromelt (L, 1);
414 obj = ucl_object_lua_fromtable (L, idx);
424 obj = ucl_object_new_userdata (lua_ucl_userdata_dtor,
432 return obj;
447 ucl_object_t *obj;
453 obj = ucl_object_lua_fromtable (L, idx);
456 obj = ucl_object_lua_fromelt (L, idx);
460 return obj;
464 lua_ucl_to_string (lua_State *L, const ucl_object_t *obj, enum ucl_emitter type)
468 result = ucl_object_emit (obj, type);
517 lua_ucl_push_opaque (lua_State *L, ucl_object_t *obj)
522 *pobj = obj;
614 ucl_object_t *obj;
618 obj = ucl_parser_get_object (parser);
620 if (obj != NULL) {
621 ret = ucl_object_push_lua (L, obj, false);
623 ucl_object_unref (obj);
642 ucl_object_t *obj;
646 obj = ucl_parser_get_object (parser);
648 if (obj != NULL) {
649 lua_ucl_push_opaque (L, obj);
750 ucl_object_t *obj;
752 obj = lua_ucl_object_get (L, 1);
754 if (obj) {
755 ucl_object_push_lua (L, obj, true);
780 ucl_object_t *obj;
783 obj = lua_ucl_object_get (L, 1);
785 if (obj) {
806 return lua_ucl_to_string (L, obj, format);
830 ucl_object_t *obj, *schema, *ext_refs = NULL;
836 obj = lua_ucl_object_get (L, 1);
839 if (schema && obj && ucl_object_type (schema) == UCL_OBJECT) {
871 res = ucl_object_validate_root_ext (schema_elt, obj, schema,
916 ucl_object_t *obj;
918 obj = lua_ucl_object_get (L, 1);
920 ucl_object_unref (obj);
989 ucl_object_t *obj;
998 obj = ucl_object_lua_import (L, 1);
999 if (obj != NULL) {
1000 lua_ucl_to_string (L, obj, format);
1001 ucl_object_unref (obj);
1013 ucl_object_t *obj;
1015 obj = ucl_object_lua_import (L, 1);
1016 if (obj != NULL) {
1017 lua_ucl_to_string (L, obj, UCL_EMIT_CONFIG);
1018 ucl_object_unref (obj);
1064 ucl_object_t *obj;
1094 obj = ucl_object_lua_import (L, 1);
1095 if (obj != NULL) {
1096 lua_ucl_to_string (L, obj, format);
1097 ucl_object_unref (obj);
1166 ucl_object_toclosure (const ucl_object_t *obj)
1168 if (obj == NULL || obj->type != UCL_USERDATA) {
1172 return (struct ucl_lua_funcdata*)obj->value.ud;