diff options
author | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-05-16 13:06:57 +0000 |
---|---|---|
committer | whiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2009-05-16 13:06:57 +0000 |
commit | 1b2346740c8b23f56a29bcbb646266667a911f6b (patch) | |
tree | a79112a4ff1c0ec22fca5b7d5234693cc640504a /Lua/src/lua/ULuaParty.pas | |
parent | 0612fdf8fd4badc25e4f1faab24f73c93b690389 (diff) | |
download | usdx-1b2346740c8b23f56a29bcbb646266667a911f6b.tar.gz usdx-1b2346740c8b23f56a29bcbb646266667a911f6b.tar.xz usdx-1b2346740c8b23f56a29bcbb646266667a911f6b.zip |
add Lua_GetOwner to ULuaUtils (function returns plugin by lua state)
use new function in ULuaParty and ULuaUsdx
new lua function: Usdx.ShutMeDown to give plugins the ability to unload
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1732 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Lua/src/lua/ULuaParty.pas | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Lua/src/lua/ULuaParty.pas b/Lua/src/lua/ULuaParty.pas index 41a0d2ae..25cfce94 100644 --- a/Lua/src/lua/ULuaParty.pas +++ b/Lua/src/lua/ULuaParty.pas @@ -101,14 +101,13 @@ function ULuaParty_Register(L: Plua_State): Integer; cdecl; var
Info: TParty_ModeInfo;
Key: String;
+ P: TLuaPlugin;
begin
// check for table on stack
luaL_checkType(L, 1, LUA_TTABLE);
// get parent id
- lua_getfield (L, LUA_REGISTRYINDEX, '_USDX_STATE_ID');
- if (not lua_isNumber(L, -1)) then
- luaL_error(L, 'unable to get _USDX_STATE_ID in ULuaParty_Register');
+ P := Lua_GetOwner(L);
// set mode info to default
@@ -116,8 +115,7 @@ begin // set parent in info rec and pop it from stack
- Info.Parent := lua_toInteger(L, -1);
- lua_pop(L, 1);
+ Info.Parent := P.Id;
// go through table elements
lua_pushNil(L);
|