mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Added resources, and changed slightly how wrappers expose functions.
This commit is contained in:
@@ -155,8 +155,11 @@ namespace love
|
||||
return 0;
|
||||
}
|
||||
|
||||
int luax_register_module(lua_State * L, const luaL_Reg * fn, const lua_CFunction * types)
|
||||
int luax_register_module(lua_State * L, const luaL_Reg * fn, const lua_CFunction * types, const char * name)
|
||||
{
|
||||
// Gets the love table.
|
||||
lua_getglobal(L, "love");
|
||||
|
||||
// Create new table for module.
|
||||
lua_newtable(L);
|
||||
|
||||
@@ -168,7 +171,10 @@ namespace love
|
||||
for(const lua_CFunction * t = types; *t != 0; t++)
|
||||
(*t)(L);
|
||||
|
||||
return 1;
|
||||
lua_setfield(L, -2, name); // love.graphics = table
|
||||
lua_pop(L, 1); // love
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int luax_preload(lua_State * L, lua_CFunction f, const char * name)
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace love
|
||||
const char * provides, const char * desc, const char * author,
|
||||
lua_CFunction open);
|
||||
|
||||
int luax_register_module(lua_State * L, const luaL_Reg * fn, const lua_CFunction * types);
|
||||
int luax_register_module(lua_State * L, const luaL_Reg * fn, const lua_CFunction * types, const char * name);
|
||||
int luax_preload(lua_State * L, lua_CFunction f, const char * name);
|
||||
int luax_register_type(lua_State * L, const char * tname, const luaL_Reg * fn);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user