summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_base.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-12-12 14:49:19 -0500
committerShadowNinja <shadowninja@minetest.net>2017-05-06 15:33:19 -0400
commit43d1f375d18a2fbc547a9b4f23d1354d645856ca (patch)
tree15de6977737b440b9d265f85dc1fe3c71e996a45 /src/script/lua_api/l_base.cpp
parenta024042bf5ad487685e952da7b96ffa845cd7731 (diff)
downloadminetest-43d1f375d18a2fbc547a9b4f23d1354d645856ca.tar.gz
minetest-43d1f375d18a2fbc547a9b4f23d1354d645856ca.tar.bz2
minetest-43d1f375d18a2fbc547a9b4f23d1354d645856ca.zip
Use a settings object for the main settings
This unifies the settings APIs. This also unifies the sync and async registration APIs, since the async registration API did not support adding non-functions to the API table.
Diffstat (limited to 'src/script/lua_api/l_base.cpp')
-rw-r--r--src/script/lua_api/l_base.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/script/lua_api/l_base.cpp b/src/script/lua_api/l_base.cpp
index dfe743b72..5d7ba9640 100644
--- a/src/script/lua_api/l_base.cpp
+++ b/src/script/lua_api/l_base.cpp
@@ -74,17 +74,13 @@ std::string ModApiBase::getCurrentModPath(lua_State *L)
}
-bool ModApiBase::registerFunction(
- lua_State *L,
- const char *name,
- lua_CFunction fct,
- int top)
+bool ModApiBase::registerFunction(lua_State *L, const char *name,
+ lua_CFunction func, int top)
{
- //TODO check presence first!
+ // TODO: Check presence first!
- lua_pushstring(L,name);
- lua_pushcfunction(L,fct);
- lua_settable(L, top);
+ lua_pushcfunction(L, func);
+ lua_setfield(L, top, name);
return true;
}