aboutsummaryrefslogtreecommitdiffstats
path: root/Lua/src
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-12-12 16:54:15 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2009-12-12 16:54:15 +0000
commita29406a0185dc125144f22a3d45ae3d08a9ecd14 (patch)
tree93d9772aba4c7b44b6c0657e81889f9c76dc4807 /Lua/src
parent8bf5f8540991f0d7128f0a0967b03b8b1cc84461 (diff)
downloadusdx-a29406a0185dc125144f22a3d45ae3d08a9ecd14.tar.gz
usdx-a29406a0185dc125144f22a3d45ae3d08a9ecd14.tar.xz
usdx-a29406a0185dc125144f22a3d45ae3d08a9ecd14.zip
fixed plugin loading
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@2021 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Lua/src')
-rw-r--r--Lua/src/lua/ULuaCore.pas19
-rw-r--r--Lua/src/lua/ULuaUsdx.pas5
2 files changed, 14 insertions, 10 deletions
diff --git a/Lua/src/lua/ULuaCore.pas b/Lua/src/lua/ULuaCore.pas
index d3231ae2..99dd8872 100644
--- a/Lua/src/lua/ULuaCore.pas
+++ b/Lua/src/lua/ULuaCore.pas
@@ -195,7 +195,13 @@ var
LuaCore: TLuaCore;
implementation
-uses ULog, UFilesystem, ULuaUsdx, UPathUtils, StrUtils;
+uses
+ StrUtils,
+ ULog,
+ UFilesystem,
+ ULuaUsdx,
+ UPathUtils,
+ ULuaUtils;
constructor TLuaCore.Create;
begin
@@ -713,8 +719,6 @@ end;
{ does the main loading part
can not be called by create, because Plugins[Id] isn't defined there }
procedure TLuaPlugin.Load;
- var
- Filename: String;
begin
// create Lua state for this plugin
State := luaL_newstate;
@@ -723,11 +727,10 @@ begin
//we don't expect
lua_atPanic(State, TLua_CustomPanic);
- Filename := Self.Filename.ToNative;
// to-do : fix this
// it may solve the problem if we read the file
// and pass lua the text }
- if ({luaL_loadfile(State, PChar(Filename))}1 = 0) then
+ if (LuaL_LoadFile(State, PChar(Filename.ToNative)) = 0) then
begin // file loaded successful
{ note: we run the file here, but the environment isn't
set up now. it just causes the functions to
@@ -767,7 +770,7 @@ begin
else
begin
sStatus := psErrorInInit;
- Log.LogError('error in plugin_init: ' + Self.Filename.ToUTF8, 'lua');
+ Log.LogError('error in plugin_init: ' + Self.Filename.ToNative, 'lua');
Unload;
end;
end
@@ -775,7 +778,7 @@ begin
begin
sStatus := psErrorOnLoad;
Log.LogError(String(lua_toString(State, 1)), 'lua');
- Log.LogError('unable to call file: ' + Self.Filename.ToUTF8, 'lua');
+ Log.LogError('unable to call file: ' + Self.Filename.ToNative, 'lua');
Unload;
end;
@@ -784,7 +787,7 @@ begin
begin
sStatus := psErrorOnLoad;
Log.LogError(String(lua_toString(State, 1)), 'lua');
- Log.LogError('unable to load file: ' + Self.Filename.ToUTF8, 'lua');
+ Log.LogError('unable to load file: ' + Self.Filename.ToNative, 'lua');
Unload;
end;
end;
diff --git a/Lua/src/lua/ULuaUsdx.pas b/Lua/src/lua/ULuaUsdx.pas
index c38eec4c..d92289b1 100644
--- a/Lua/src/lua/ULuaUsdx.pas
+++ b/Lua/src/lua/ULuaUsdx.pas
@@ -54,11 +54,12 @@ function ULuaUsdx_Hook(L: Plua_State): Integer; cdecl;
function ULuaUsdx_ShutMeDown(L: Plua_State): Integer; cdecl;
const
- ULuaUsdx_Lib_f: array [0..3] of lual_reg = (
+ ULuaUsdx_Lib_f: array [0..4] of lual_reg = (
(name:'Version'; func:ULuaUsdx_Version),
(name:'Time'; func:ULuaUsdx_Time),
(name:'Hook'; func:ULuaUsdx_Hook),
- (name:'ShutMeDown'; func:ULuaUsdx_ShutMeDown)
+ (name:'ShutMeDown'; func:ULuaUsdx_ShutMeDown),
+ (name:nil;func:nil)
);
implementation