diff options
author | k-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2013-05-03 23:59:09 +0000 |
---|---|---|
committer | k-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2013-05-03 23:59:09 +0000 |
commit | 330ca90b8af24c1fdc56aab80809d0992c53a181 (patch) | |
tree | 61949d2960b03455cb1e015b5e971a36494c085b /src/lua | |
parent | ceb95e93b81ee77bc1b89289bd1c1c506e422e88 (diff) | |
download | usdx-330ca90b8af24c1fdc56aab80809d0992c53a181.tar.gz usdx-330ca90b8af24c1fdc56aab80809d0992c53a181.tar.xz usdx-330ca90b8af24c1fdc56aab80809d0992c53a181.zip |
extent for lua 5.2
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2981 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/ULuaCore.pas | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lua/ULuaCore.pas b/src/lua/ULuaCore.pas index d1b6e7d2..a0398eb4 100644 --- a/src/lua/ULuaCore.pas +++ b/src/lua/ULuaCore.pas @@ -564,16 +564,17 @@ begin {**** replace the standard require with our custom require function }
// first move standard require function to _require
- lua_getfield(L, LUA_GLOBALSINDEX, PChar('require'));
- lua_setfield(L, LUA_GLOBALSINDEX, PChar('_require'));
+ lua_getglobal(L, PChar('require'));
+
+ lua_setglobal(L, PChar('_require'));
// then save custom require function to require
lua_pushcfunction(L, TLua_CustomRequire);
- lua_setfield(L, LUA_GLOBALSINDEX, PChar('require'));
+
+ lua_setglobal(L, PChar('require'));
{**** now we create the usdx table }
// at first functions from ULuaUsdx
-// Function luaL_register is deprecated. Use luaL_setfuncs so that your module does not create globals. (Modules are not expected to set global variables anymore.)
luaL_register(L, 'Usdx', @ULuaUsdx_Lib_f[0]);
end;
@@ -651,7 +652,6 @@ begin begin
Id := lua_ToInteger(L, lua_upvalueindex(1));
-// Function luaL_register is deprecated. Use luaL_setfuncs so that your module does not create globals. (Modules are not expected to set global variables anymore.)
luaL_register(L, PChar('Usdx.' + LuaCore.Modules[Id].Name), @LuaCore.Modules[Id].Functions[0]);
// set the modules table as global "modulename"
@@ -846,8 +846,7 @@ begin // we need at least one stack slot free
lua_checkstack(State, 1);
- // lua_getglobal(State, PChar(Name)); // this is just a macro:
- lua_getfield(State, LUA_GLOBALSINDEX, PChar(Name));
+ lua_getglobal(State, PChar(Name));
if (lua_isfunction(State, -1)) then
begin // we got a function
@@ -1015,7 +1014,7 @@ begin while (lua_getTop(L) >= 1) do
begin
// get luas require function
- lua_getfield(L, LUA_GLOBALSINDEX, PChar('_require'));
+ lua_getglobal(L, PChar('_require'));
// move it under the top param
lua_insert(L, -2);
|