46 luaL_argerror(L,
n,
"widget was deleted");
56 luaL_argerror(L,
n,
"widget was deleted");
71 lua_rawget(L, LUA_REGISTRYINDEX);
72 if(lua_isnoneornil(L, -1)) {
74 lua_createtable(L, 0, 0);
76 lua_pushvalue(L , -2);
77 lua_rawset(L, LUA_REGISTRYINDEX);
84 lua_pushlightuserdata(L, owner);
86 if(lua_isnoneornil(L, -1))
91 lua_createtable(L, 1, 0);
93 lua_pushlightuserdata(L, owner);
100 lua_remove(L, lua_absindex(L, -2));
106 lua_pushlightuserdata(L, owner);
116 lua_pushlightuserdata(L, wg);
118 if(lua_isnoneornil(L, -1))
123 lua_createtable(L, 1, 0);
127 lua_rawseti(L, -2, 1);
129 lua_pushlightuserdata(L, wg);
131 lua_pushvalue(L, -2);
136 lua_remove(L, lua_absindex(L, -2));
149 bool existed_already = !lua_isnoneornil(L, -1);
154 lua_rotate(L, lua_absindex(L, -3), -1);
159 return existed_already;
170 lua_remove(L, lua_absindex(L, -2));
177 assert(lua_isfunction(L, -1));
195 lua_pushinteger(L, list->get_item_count());
197 lua_pushinteger(L, multi_page->get_page_count());
199 lua_pushinteger(L, stacked_widget->get_layer_count());
201 lua_pushinteger(L, tree_view->get_root_node().count_children());
203 lua_pushinteger(L, tree_view_node->count_children());
206 return luaL_error(L,
"unsupported widget for # operator: %s", luaL_checkstring(L, -1));
217 lua_setfield(L, -2,
"__index");
219 lua_setfield(L, -2,
"__newindex");
221 lua_setfield(L, -2,
"__dir");
223 lua_setfield(L, -2,
"__gc");
225 lua_setfield(L, -2,
"__len");
227 lua_setfield(L, -2,
"__metatable");
base class of top level items, the only item which needs to store the final canvases to draw on.
Tmust inherit enable_lua_ptr<T>
bool luaW_tableget(lua_State *L, int index, const char *key)
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
void lua_push(lua_State *L, const T &val)
static map_location::direction n