lua_result_t lua_bind_int(lua_t* env, const char* property, size_t length, int value) { #if BUILD_ENABLE_LUA_THREAD_SAFE if (!lua_acquire_execution_right(env, false)) { lua_op_t op; op.cmd = LUACMD_BIND_INT; op.data.name = property; op.size = length; op.arg.value[0].ival = value; lua_push_op(env, &op); return LUA_QUEUED; } lua_value_t val = { .ival = value }; lua_result_t res = lua_do_bind(env, property, length, LUACMD_BIND_INT, val); lua_execute_pending(env); lua_release_execution_right(env); return res; #else lua_value_t val = { .ival = value }; return lua_do_bind(env, property, length, LUACMD_BIND_INT, val); #endif }
lua_result_t lua_bind_function(lua_t* env, const char* method, size_t length, lua_fn fn) { #if BUILD_ENABLE_LUA_THREAD_SAFE if (!lua_acquire_execution_right(env, false)) { lua_op_t op; op.cmd = LUACMD_BIND; op.data.name = method; op.size = length; op.arg.value[0].fn = fn; lua_push_op(env, &op); return LUA_QUEUED; } lua_value_t val = { .fn = fn }; lua_result_t res = lua_do_bind(env, method, length, LUACMD_BIND, val); lua_execute_pending(env); lua_release_execution_right(env); return res; #else lua_value_t val = { .fn = fn }; return lua_do_bind(env, method, length, LUACMD_BIND, val); #endif }
lua_result_t lua_call_custom(lua_t* env, const char* method, size_t length, lua_arg_t* arg) { #if BUILD_ENABLE_LUA_THREAD_SAFE if (!lua_acquire_execution_right(env, false)) { lua_op_t op; op.cmd = LUACMD_CALL; op.data.name = method; op.size = length; if (arg) op.arg = *arg; else op.arg.num = 0; lua_push_op(env, &op); return LUA_QUEUED; } lua_execute_pending(env); lua_result_t res = lua_do_call_custom(env, method, length, arg); lua_release_execution_right(env); return res; #else return lua_do_call_custom(env, method, length, arg); #endif }