diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3f4f5bb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/__history/
diff --git a/Lua.API.pas b/Lua.API.pas
index f98c8e7..3ff0c9d 100644
--- a/Lua.API.pas
+++ b/Lua.API.pas
@@ -69,7 +69,7 @@ const
type
- size_t = Cardinal;
+ size_t = NativeUint;
psize_t = ^size_t;
lua_State = type Pointer;
diff --git a/Lua.pas b/Lua.pas
index c1a050a..0a0ff6a 100644
--- a/Lua.pas
+++ b/Lua.pas
@@ -282,7 +282,7 @@ type
constructor Create(const AStream: TStream; AOwnership: TStreamOwnership = soReference); overload;
destructor Destroy; override;
- function GetNextChunk(out ASize: Cardinal): PAnsiChar; virtual;
+ function GetNextChunk(out ASize: NativeUint): PAnsiChar; virtual;
end;
@@ -300,7 +300,7 @@ type
function GetHasState: Boolean; virtual;
function GetState: lua_State; virtual;
- function DoAlloc(APointer: Pointer; AOldSize, ANewSize: Cardinal): Pointer; virtual;
+ function DoAlloc(APointer: Pointer; AOldSize, ANewSize: NativeUint): Pointer; virtual;
procedure DoNewState; virtual;
procedure DoClose; virtual;
@@ -826,7 +826,7 @@ end;
class function TLuaHelpers.LuaToString(AState: lua_State; AIndex: Integer): string;
var
- len: Cardinal;
+ len: NativeUint;
value: PAnsiChar;
stringValue: RawByteString;
@@ -1050,7 +1050,10 @@ begin
Result := BobJenkinsHash(s[1], Length(s) * SizeOf(s[1]), 0);
end;
VariableTable:
- Result := Integer(Value.AsTable);
+ begin
+ p := Pointer(Value.AsTable);
+ Result := BobJenkinsHash(p, SizeOf(p), 0);
+ end;
end;
end;
@@ -1203,7 +1206,7 @@ begin
end;
-function TLuaScript.GetNextChunk(out ASize: Cardinal): PAnsiChar;
+function TLuaScript.GetNextChunk(out ASize: NativeUint): PAnsiChar;
const
BufferSize = 4096;
@@ -1594,7 +1597,7 @@ begin
end;
-function TLua.DoAlloc(APointer: Pointer; AOldSize, ANewSize: Cardinal): Pointer;
+function TLua.DoAlloc(APointer: Pointer; AOldSize, ANewSize: NativeUint): Pointer;
begin
Result := DefaultLuaAlloc(nil, APointer, AOldSize, ANewSize);
end;
@@ -1618,7 +1621,12 @@ end;
procedure TLua.DoRegistration(ARegistration: TCustomLuaRegistration);
+var
+ this: TLua;
+
begin
+ this := Self;
+
ARegistration.Apply(State,
procedure(AFunction: TLuaCFunction)
var
@@ -1628,7 +1636,7 @@ begin
cookie := GetRegisteredFunctionCookie;
RegisteredFunctions.Add(cookie, AFunction);
- lua_pushlightuserdata(State, Self);
+ lua_pushlightuserdata(State, this);
lua_pushinteger(State, Cookie);
lua_pushcclosure(State, @LuaWrapperFunction, 2);
end);
diff --git a/README.md b/README.md
index 6fbf40a..f3ba9c4 100644
--- a/README.md
+++ b/README.md
@@ -4,11 +4,11 @@
This project consists of two parts: a straight-up conversion of the [LuaBinaries](http://luabinaries.sourceforge.net/) 5.2 C headers to Delphi, and the TLua class to make integrating Lua with Delphi projects easier.
##### A note on compatibility
-It's been tested and developed on Delphi XE2 32-bits. Minimum version for the wrapper is probably 2010, due to anonymous functions and TRttiContext being used. I also know for sure that the code isn't 64-bits compatible yet.
+It's been tested and developed on Delphi XE2 32-bits and 64-bits. Minimum version for the wrapper is probably 2010, due to anonymous functions and TRttiContext being used.
### Getting started
-Download lua-5.2.4_Win32_bin.zip from [LuaBinaries](http://luabinaries.sourceforge.net/) and extract lua52.dll.
+Download lua-5.2.4_Win32_bin.zip or lua-5.2.4_Win64_bin.zip from [LuaBinaries](http://luabinaries.sourceforge.net/) and extract lua52.dll.
If you're just interested in the API, the [Lua manual](http://www.lua.org/manual/5.2/manual.html#4) is the best place to start.
diff --git a/UnitTests/.gitignore b/UnitTests/.gitignore
new file mode 100644
index 0000000..9898608
--- /dev/null
+++ b/UnitTests/.gitignore
@@ -0,0 +1,2 @@
+*.local
+*.identcache
diff --git a/UnitTests/DelphiLuaUnitTests.dproj b/UnitTests/DelphiLuaUnitTests.dproj
index af41a51..2f9e909 100644
--- a/UnitTests/DelphiLuaUnitTests.dproj
+++ b/UnitTests/DelphiLuaUnitTests.dproj
@@ -6,7 +6,7 @@
True
Debug
Win32
- 1
+ 3
Console
DelphiLuaUnitTests.dpr
@@ -28,6 +28,12 @@
Base
true
+
+ true
+ Cfg_1
+ true
+ true
+
true
Cfg_1
@@ -39,6 +45,12 @@
Base
true
+
+ true
+ Cfg_2
+ true
+ true
+
true
Cfg_2
@@ -55,9 +67,17 @@
.\bin
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)
+ .\bin\win64
+ true
+ .\lib\win64
+ 1033
+ $(BDS)\bin\default_app.manifest
dxdborRS16;cxLibraryRS16;dxLayoutControlRS16;dxPScxPivotGridLnkRS16;dxCoreRS16;cxExportRS16;dxBarRS16;cxSpreadSheetRS16;cxTreeListdxBarPopupMenuRS16;TeeDB;dxDBXServerModeRS16;dxPsPrVwAdvRS16;dxPSCoreRS16;dxPScxTLLnkRS16;dxPScxGridLnkRS16;cxPageControlRS16;dxRibbonRS16;DBXSybaseASEDriver;vclimg;cxTreeListRS16;dxComnRS16;vcldb;vcldsnap;dxBarExtDBItemsRS16;DBXDb2Driver;vcl;DBXMSSQLDriver;cxDataRS16;cxBarEditItemRS16;dxDockingRS16;cxPageControldxBarPopupMenuRS16;cxSchedulerGridRS16;dxPSLnksRS16;dxBarExtItemsRS16;dxtrmdRS16;webdsnap;dxPSdxLCLnkRS16;dxorgcRS16;dxWizardControlRS16;dxPScxExtCommonRS16;dxNavBarRS16;dxPSdxDBOCLnkRS16;cxSchedulerTreeBrowserRS16;Tee;DBXOdbcDriver;dxdbtrRS16;dxPScxSSLnkRS16;cxPivotGridChartRS16;dxPScxCommonRS16;dxmdsRS16;dxPSPrVwRibbonRS16;cxGridRS16;cxEditorsRS16;cxPivotGridRS16;dxPSdxDBTVLnkRS16;dxPScxSchedulerLnkRS16;TeeUI;dxServerModeRS16;bindcompvcl;vclactnband;vclie;cxSchedulerRS16;vcltouch;websnap;VclSmp;dxTabbedMDIRS16;dxPSdxOCLnkRS16;dsnapcon;dxPSdxFCLnkRS16;dxThemeRS16;dxPScxPCProdRS16;vclx;dxFlowChartRS16;dxGDIPlusRS16;dxBarDBNavRS16;$(DCC_UsePackage)
+ .\bin\win32
+ .\lib\win32
dxdborRS16;cxLibraryRS16;dxLayoutControlRS16;dxPScxPivotGridLnkRS16;dxCoreRS16;cxExportRS16;dxBarRS16;cxSpreadSheetRS16;cxTreeListdxBarPopupMenuRS16;TeeDB;dxDBXServerModeRS16;dxPsPrVwAdvRS16;vclib;dxPSCoreRS16;dxPScxTLLnkRS16;dxPScxGridLnkRS16;inetdbbde;cxPageControlRS16;dxRibbonRS16;DBXSybaseASEDriver;vclimg;cxTreeListRS16;fmi;dxComnRS16;vcldb;vcldsnap;dxBarExtDBItemsRS16;X2CLGL;DBXDb2Driver;vcl;CloudService;DBXMSSQLDriver;CodeSiteExpressPkg;FmxTeeUI;cxDataRS16;cxBarEditItemRS16;dxDockingRS16;cxPageControldxBarPopupMenuRS16;cxSchedulerGridRS16;dxPSLnksRS16;dxBarExtItemsRS16;dxtrmdRS16;webdsnap;X2CLMB;OmniThreadLibraryRuntimeXE2;adortl;dxPSdxLCLnkRS16;dxorgcRS16;dxWizardControlRS16;dxPScxExtCommonRS16;vcldbx;dxNavBarRS16;dxPSdxDBOCLnkRS16;cxSchedulerTreeBrowserRS16;Tee;DBXOdbcDriver;dxdbtrRS16;svnui;dxPScxSSLnkRS16;cxPivotGridChartRS16;dxPScxCommonRS16;dxmdsRS16;dxPSPrVwRibbonRS16;ibxpress;cxGridRS16;cxEditorsRS16;cxPivotGridRS16;dxPSdxDBTVLnkRS16;FMXTee;dxPScxSchedulerLnkRS16;TeeUI;dxServerModeRS16;bindcompvcl;vclactnband;vclie;cxSchedulerRS16;vcltouch;websnap;VclSmp;dxTabbedMDIRS16;DataSnapConnectors;dxPSdxOCLnkRS16;dsnapcon;dxPSdxFCLnkRS16;dxThemeRS16;dxPScxPCProdRS16;vclx;svn;dxFlowChartRS16;bdertl;VirtualTreesR;dxGDIPlusRS16;dxBarDBNavRS16;$(DCC_UsePackage)
Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
1033
@@ -69,6 +89,13 @@
true
true
+
+ .\bin\win64
+ true
+ $(BDS)\bin\default_app.manifest
+ 1033
+ .\lib\win64
+
1033
false
@@ -79,6 +106,11 @@
0
false
+
+ true
+ $(BDS)\bin\default_app.manifest
+ 1033
+
1033
@@ -138,12 +170,13 @@
DelphiLuaUnitTests.dpr
- JVCL BDE Components
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
- False
+ True
False
True
diff --git a/UnitTests/DelphiLuaUnitTests.res b/UnitTests/DelphiLuaUnitTests.res
index 7435995..93e7e94 100644
Binary files a/UnitTests/DelphiLuaUnitTests.res and b/UnitTests/DelphiLuaUnitTests.res differ