diff options
| author | ShadowNinja <shadowninja@minetest.net> | 2017-06-03 14:55:10 -0400 |
|---|---|---|
| committer | ShadowNinja <shadowninja@minetest.net> | 2017-06-03 14:55:10 -0400 |
| commit | caecdb681c428c1aab9c0f7eec2570c0460f995c (patch) | |
| tree | e5115982ea59bbf2343ba9b35bc4a0cfbb56f407 /src/script/lua_api/l_base.cpp | |
| parent | 81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (diff) | |
| parent | 80dc961d24e1964e25d57039ddb2ba639f9f4d22 (diff) | |
| download | minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.xz | |
Merge 0.4.16 into stable-0.4
Diffstat (limited to 'src/script/lua_api/l_base.cpp')
| -rw-r--r-- | src/script/lua_api/l_base.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/script/lua_api/l_base.cpp b/src/script/lua_api/l_base.cpp index 515a7d933..5d7ba9640 100644 --- a/src/script/lua_api/l_base.cpp +++ b/src/script/lua_api/l_base.cpp @@ -37,6 +37,18 @@ Server *ModApiBase::getServer(lua_State *L) return getScriptApiBase(L)->getServer(); } +#ifndef SERVER +Client *ModApiBase::getClient(lua_State *L) +{ + return getScriptApiBase(L)->getClient(); +} +#endif + +IGameDef *ModApiBase::getGameDef(lua_State *L) +{ + return getScriptApiBase(L)->getGameDef(); +} + Environment *ModApiBase::getEnv(lua_State *L) { return getScriptApiBase(L)->getEnv(); @@ -62,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; } |
