| 3806 | } |
| 3807 | |
| 3808 | static int db_create_thread(Lua L) |
| 3809 | { |
| 3810 | // ... |
| 3811 | // funcarg2 |
| 3812 | // funcarg1 |
| 3813 | // func |
| 3814 | // db |
| 3815 | |
| 3816 | luaL_checkudata(L, 1, dbtypes.db); |
| 3817 | lua_remove(L, 1); |
| 3818 | |
| 3819 | luaL_checktype(L, 1, LUA_TFUNCTION); |
| 3820 | lua_getglobal(L, "_SP"); |
| 3821 | lua_getfield(L, -1, "cdb2_func_refs"); |
| 3822 | lua_remove(L, -2); // _SP |
| 3823 | |
| 3824 | lua_pushvalue(L, 1); // key for lookup is func; move to top |
| 3825 | lua_remove(L, 1); |
| 3826 | lua_gettable(L, -2); |
| 3827 | |
| 3828 | const char *funcname = lua_tostring(L, -1); |
| 3829 | lua_pop(L, 2); // string, cdb2_func_refs |
| 3830 | |
| 3831 | // ... |
| 3832 | // funcarg2 |
| 3833 | // funcarg1 |
| 3834 | return db_create_thread_int(L, funcname); |
| 3835 | } |
| 3836 | |
| 3837 | static int db_table(lua_State *lua) |
| 3838 | { |
nothing calls this directly
no test coverage detected