Added resources, and changed slightly how wrappers expose functions.

This commit is contained in:
rude
2009-07-30 00:37:43 +02:00
parent 8f4662c8a2
commit 0c241a14fb
30 changed files with 454 additions and 222 deletions
+8 -2
View File
@@ -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)
+1 -1
View File
@@ -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);