diff --git a/KeraLua.Symbol.nuspec b/KeraLua.Symbol.nuspec
index 1e96da0..3876f90 100644
--- a/KeraLua.Symbol.nuspec
+++ b/KeraLua.Symbol.nuspec
@@ -10,7 +10,7 @@
https://raw.githubusercontent.com/nlua/KeraLua/main/KeraLua.png
false
- C# Native bindings of Lua 5.4 (compatible with iOS/Mac/Android/UWP/.NET)
+ C# Native bindings of Lua 5.5 (compatible with iOS/Mac/Android/UWP/.NET)
Release: 2bffe65
Copyright © Vinicius Jarina 2026
diff --git a/KeraLua.nuspec b/KeraLua.nuspec
index 53a75e5..5961b36 100644
--- a/KeraLua.nuspec
+++ b/KeraLua.nuspec
@@ -10,7 +10,7 @@
https://raw.githubusercontent.com/nlua/KeraLua/main/KeraLua.png
false
- C# Native bindings of Lua 5.4 (compatible with iOS/Mac/Android/.NET/UWP)
+ C# Native bindings of Lua 5.5 (compatible with iOS/Mac/Android/.NET/UWP)
Release: 2bffe65
Copyright © Vinicius Jarina 2026
@@ -71,27 +71,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.md b/README.md
index e83f906..55debd9 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ KeraLua
| | [](https://dev.azure.com/codefoco/NuGets/_build/latest?definitionId=64&branchName=main) |
-C# Native bindings of Lua 5.4 (compatible with iOS/Mac/Android/UWP/.NET)
+C# Native bindings of Lua 5.5 (compatible with iOS/Mac/Android/UWP/.NET)
Before build fetch the submodules:
diff --git a/build/Android/KeraLua.Android.csproj b/build/Android/KeraLua.Android.csproj
index 58d6b58..89367ac 100644
--- a/build/Android/KeraLua.Android.csproj
+++ b/build/Android/KeraLua.Android.csproj
@@ -48,17 +48,17 @@
-
- libs\arm64-v8a\liblua54.so
+
+ libs\arm64-v8a\liblua55.so
-
- libs\armeabi-v7a\liblua54.so
+
+ libs\armeabi-v7a\liblua55.so
-
- libs\x86\liblua54.so
+
+ libs\x86\liblua55.so
-
- libs\x86_64\liblua54.so
+
+ libs\x86_64\liblua55.so
diff --git a/build/Android/KeraLua.net9.0-android.csproj b/build/Android/KeraLua.net9.0-android.csproj
index 9034e1f..106b6b5 100644
--- a/build/Android/KeraLua.net9.0-android.csproj
+++ b/build/Android/KeraLua.net9.0-android.csproj
@@ -42,17 +42,17 @@
-
- libs\arm64-v8a\liblua54.so
+
+ libs\arm64-v8a\liblua55.so
-
- libs\armeabi-v7a\liblua54.so
+
+ libs\armeabi-v7a\liblua55.so
-
- libs\x86\liblua54.so
+
+ libs\x86\liblua55.so
-
- libs\x86_64\liblua54.so
+
+ libs\x86_64\liblua55.so
diff --git a/build/TVOS/KeraLua.TVOS.csproj b/build/TVOS/KeraLua.TVOS.csproj
index 6cc7115..76f27d6 100644
--- a/build/TVOS/KeraLua.TVOS.csproj
+++ b/build/TVOS/KeraLua.TVOS.csproj
@@ -52,7 +52,7 @@
-
+
Framework
diff --git a/build/TVOS/KeraLua.net9.0-tvos.csproj b/build/TVOS/KeraLua.net9.0-tvos.csproj
index f429b75..0ac4f46 100644
--- a/build/TVOS/KeraLua.net9.0-tvos.csproj
+++ b/build/TVOS/KeraLua.net9.0-tvos.csproj
@@ -47,7 +47,7 @@
-
+
Framework
diff --git a/build/iOS/KeraLua.XamariniOS.csproj b/build/iOS/KeraLua.XamariniOS.csproj
index 38bc8ef..b552d5f 100644
--- a/build/iOS/KeraLua.XamariniOS.csproj
+++ b/build/iOS/KeraLua.XamariniOS.csproj
@@ -42,7 +42,7 @@
-
+
Framework
diff --git a/build/iOS/KeraLua.net9.0-ios.csproj b/build/iOS/KeraLua.net9.0-ios.csproj
index 6ec0578..94558ff 100644
--- a/build/iOS/KeraLua.net9.0-ios.csproj
+++ b/build/iOS/KeraLua.net9.0-ios.csproj
@@ -38,7 +38,7 @@
-
+
Framework
diff --git a/build/iOS/KeraLua.net9.0-maccatalyst.csproj b/build/iOS/KeraLua.net9.0-maccatalyst.csproj
index 417295f..6ffffa7 100644
--- a/build/iOS/KeraLua.net9.0-maccatalyst.csproj
+++ b/build/iOS/KeraLua.net9.0-maccatalyst.csproj
@@ -38,7 +38,7 @@
-
+
Framework
diff --git a/build/macOS/KeraLua.XamarinMac.csproj b/build/macOS/KeraLua.XamarinMac.csproj
index e836544..850a579 100644
--- a/build/macOS/KeraLua.XamarinMac.csproj
+++ b/build/macOS/KeraLua.XamarinMac.csproj
@@ -41,7 +41,7 @@
-
+
Dynamic
False
diff --git a/build/macOS/KeraLua.net9.0-macos.csproj b/build/macOS/KeraLua.net9.0-macos.csproj
index 36b0a8d..999909e 100644
--- a/build/macOS/KeraLua.net9.0-macos.csproj
+++ b/build/macOS/KeraLua.net9.0-macos.csproj
@@ -39,7 +39,7 @@
-
+
Dynamic
False
diff --git a/build/targets/BuildLua.Android.targets b/build/targets/BuildLua.Android.targets
index c11687b..8a387b1 100644
--- a/build/targets/BuildLua.Android.targets
+++ b/build/targets/BuildLua.Android.targets
@@ -3,7 +3,7 @@
android_build
android
- liblua54.so
+ liblua55.so
arm
arm64
x86
diff --git a/build/targets/BuildLua.Linux.targets b/build/targets/BuildLua.Linux.targets
index 669cfcb..fb91d92 100644
--- a/build/targets/BuildLua.Linux.targets
+++ b/build/targets/BuildLua.Linux.targets
@@ -3,9 +3,9 @@
linux-x64
linux-arm64
- lib64/liblua54.so
- $(OutputRuntimeDir)\$(LinuxAMD64BuildDir)\native\liblua54.so
- $(OutputRuntimeDir)\$(LinuxARM64BuildDir)\native\liblua54.so
+ lib64/liblua55.so
+ $(OutputRuntimeDir)\$(LinuxAMD64BuildDir)\native\liblua55.so
+ $(OutputRuntimeDir)\$(LinuxARM64BuildDir)\native\liblua55.so
diff --git a/build/targets/BuildLua.MacCatalyst.targets b/build/targets/BuildLua.MacCatalyst.targets
index 263cee2..8a9ed05 100644
--- a/build/targets/BuildLua.MacCatalyst.targets
+++ b/build/targets/BuildLua.MacCatalyst.targets
@@ -3,7 +3,7 @@
ios_build
maccatalyst
- liblua54.framework
+ liblua55.framework
diff --git a/build/targets/BuildLua.OSX.targets b/build/targets/BuildLua.OSX.targets
index 84e51f2..2d77608 100644
--- a/build/targets/BuildLua.OSX.targets
+++ b/build/targets/BuildLua.OSX.targets
@@ -5,9 +5,9 @@
osx-64
osx-arm64
osx
- lib64/liblua54.dylib
- lib/liblua54.dylib
- liblua54.dylib
+ lib64/liblua55.dylib
+ lib/liblua55.dylib
+ liblua55.dylib
10
12.2
diff --git a/build/targets/BuildLua.TVOS.targets b/build/targets/BuildLua.TVOS.targets
index 4d3ead1..b7f3a49 100644
--- a/build/targets/BuildLua.TVOS.targets
+++ b/build/targets/BuildLua.TVOS.targets
@@ -3,7 +3,7 @@
ios_build
tvos
- liblua54.framework
+ liblua55.framework
diff --git a/build/targets/BuildLua.WatchOS.targets b/build/targets/BuildLua.WatchOS.targets
index 8954467..56e3a39 100644
--- a/build/targets/BuildLua.WatchOS.targets
+++ b/build/targets/BuildLua.WatchOS.targets
@@ -3,7 +3,7 @@
ios_build
watchos
- liblua54.framework
+ liblua55.framework
diff --git a/build/targets/BuildLua.Windows.targets b/build/targets/BuildLua.Windows.targets
index a57ac36..217a5b3 100644
--- a/build/targets/BuildLua.Windows.targets
+++ b/build/targets/BuildLua.Windows.targets
@@ -5,8 +5,8 @@
win-x64
win-arm64
win-arm
- bin\lua54.dll
- bin64\lua54.dll
+ bin\lua55.dll
+ bin64\lua55.dll
diff --git a/build/targets/BuildLua.iOS.targets b/build/targets/BuildLua.iOS.targets
index e3ff379..dd81f3d 100644
--- a/build/targets/BuildLua.iOS.targets
+++ b/build/targets/BuildLua.iOS.targets
@@ -3,7 +3,7 @@
ios_build
ios
- liblua54.framework
+ liblua55.framework
diff --git a/build/targets/KeraLua.targets b/build/targets/KeraLua.targets
index afdddab..f238e6f 100644
--- a/build/targets/KeraLua.targets
+++ b/build/targets/KeraLua.targets
@@ -2,7 +2,7 @@
-
+
True
@@ -31,9 +31,9 @@
- $(MSBuildThisFileDirectory)..\..\runtimes\win-$(PreferredNativeLua)\native\lua54.dll
- $(MSBuildThisFileDirectory)..\..\runtimes\osx\native\liblua54.dylib
- $(MSBuildThisFileDirectory)..\..\runtimes\linux-$(PreferredNativeLua)\native\liblua54.so
+ $(MSBuildThisFileDirectory)..\..\runtimes\win-$(PreferredNativeLua)\native\lua55.dll
+ $(MSBuildThisFileDirectory)..\..\runtimes\osx\native\liblua55.dylib
+ $(MSBuildThisFileDirectory)..\..\runtimes\linux-$(PreferredNativeLua)\native\liblua55.so
@@ -54,35 +54,35 @@
-
- x86\lua54.dll
+
+ x86\lua55.dll
PreserveNewest
-
- x64\lua54.dll
+
+ x64\lua55.dll
PreserveNewest
-
- ARM64\lua54.dll
+
+ ARM64\lua55.dll
PreserveNewest
-
- x86\liblua54.so
+
+ x86\liblua55.so
PreserveNewest
-
- x64\liblua54.so
+
+ x64\liblua55.so
PreserveNewest
-
- ARM64\liblua54.so
+
+ ARM64\liblua55.so
PreserveNewest
diff --git a/devops/azure-devops.yml b/devops/azure-devops.yml
index a349e46..ad2d105 100644
--- a/devops/azure-devops.yml
+++ b/devops/azure-devops.yml
@@ -171,11 +171,11 @@ stages:
workingDirectory: ./external/lua
displayName: 'Build x64 Lua based on Ubuntu 18'
- - script: 'mv ./external/lua/out-arm64/liblua54.so ./runtimes/linux-arm64/native/liblua54.so'
- displayName: 'Move arm64 liblua54.so'
+ - script: 'mv ./external/lua/out-arm64/liblua55.so ./runtimes/linux-arm64/native/liblua55.so'
+ displayName: 'Move arm64 liblua55.so'
- - script: 'mv ./external/lua/out-x64/liblua54.so ./runtimes/linux-x64/native/liblua54.so'
- displayName: 'Move x64 liblua54.so'
+ - script: 'mv ./external/lua/out-x64/liblua55.so ./runtimes/linux-x64/native/liblua55.so'
+ displayName: 'Move x64 liblua55.so'
- task: MSBuild@1
displayName: 'Build solution KeraLua.sln'
@@ -184,17 +184,17 @@ stages:
configuration: Release
- task: PublishPipelineArtifact@1
- displayName: 'Publish Pipeline Artifact: liblua54.so'
+ displayName: 'Publish Pipeline Artifact: liblua55.so'
inputs:
- targetPath: 'runtimes/linux-x64/native/liblua54.so'
- artifact: 'liblua54.so.x64'
+ targetPath: 'runtimes/linux-x64/native/liblua55.so'
+ artifact: 'liblua55.so.x64'
publishLocation: 'pipeline'
- task: PublishPipelineArtifact@1
- displayName: 'Publish Pipeline Artifact: liblua54.so'
+ displayName: 'Publish Pipeline Artifact: liblua55.so'
inputs:
- targetPath: 'runtimes/linux-arm64/native/liblua54.so'
- artifact: 'liblua54.so.arm64'
+ targetPath: 'runtimes/linux-arm64/native/liblua55.so'
+ artifact: 'liblua55.so.arm64'
publishLocation: 'pipeline'
- template: send-telegram.yml@templates
@@ -354,17 +354,17 @@ stages:
targetPath: './runtimes/'
- task: DownloadPipelineArtifact@2
- displayName: 'Download Build liblua54.so x64 (Linux)'
+ displayName: 'Download Build liblua55.so x64 (Linux)'
inputs:
buildType: 'current'
- artifactName: 'liblua54.so.x64'
+ artifactName: 'liblua55.so.x64'
targetPath: 'runtimes/linux-x64/native/'
- task: DownloadPipelineArtifact@2
- displayName: 'Download Build liblua54.so arm64 (Linux)'
+ displayName: 'Download Build liblua55.so arm64 (Linux)'
inputs:
buildType: 'current'
- artifactName: 'liblua54.so.arm64'
+ artifactName: 'liblua55.so.arm64'
targetPath: 'runtimes/linux-arm64/native/'
- script: 'nuget setapikey $(apikey)'
diff --git a/external/lua b/external/lua
index d15dde2..758695c 160000
--- a/external/lua
+++ b/external/lua
@@ -1 +1 @@
-Subproject commit d15dde2db368f9a077842f892e85b6b759553b21
+Subproject commit 758695c84b8ce7da94eb0e540107fb58ff0833e9
diff --git a/src/KeraLua.Core.projitems b/src/KeraLua.Core.projitems
index 04de032..bce3ccd 100644
--- a/src/KeraLua.Core.projitems
+++ b/src/KeraLua.Core.projitems
@@ -1,28 +1,29 @@
-
-
-
- $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
- true
- {BD205AD6-760E-48F3-BAB2-21447396BD17}
-
-
- KeraLua
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
+ true
+ {BD205AD6-760E-48F3-BAB2-21447396BD17}
+
+
+ KeraLua
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Lua.cs b/src/Lua.cs
index ef75c3a..788591e 100644
--- a/src/Lua.cs
+++ b/src/Lua.cs
@@ -44,7 +44,9 @@ public Lua(bool openLibs = true)
{
Encoding = Encoding.ASCII;
- _luaState = NativeMethods.luaL_newstate();
+ _luaState = NativeMethods.luaL_newstate();
+ if (_luaState == IntPtr.Zero)
+ throw new OutOfMemoryException("Could not allocate memory for new Lua state");
if (openLibs)
OpenLibs();
@@ -55,15 +57,20 @@ public Lua(bool openLibs = true)
///
/// Initialize Lua state with allocator function and user data value
/// This method will NOT open the default libs.
- /// Creates a new thread running in a new, independent state. Returns NULL if it cannot create the thread or the state (due to lack of memory). The argument f is the allocator function; Lua does all memory allocation for this state through this function (see lua_Alloc). The second argument, ud, is an opaque pointer that Lua passes to the allocator in every call.
+ /// Creates a new thread running in a new, independent state. Returns NULL if it cannot create the thread or the state (due to lack of memory). The argument is the allocator function; Lua does all memory allocation for this state through this function (see ).
+ /// The second argument, , is an opaque pointer that Lua passes to the allocator in every call.
+ /// The third argument, , is a seed for the hashing of strings.
///
/// LuaAlloc allocator function called to alloc/free memory
/// opaque pointer passed to allocator
- public Lua(LuaAlloc allocator, IntPtr ud)
+ /// seed for the hashing of strings
+ public Lua(LuaAlloc allocator, IntPtr ud, uint seed)
{
Encoding = Encoding.ASCII;
- _luaState = NativeMethods.lua_newstate(allocator.ToFunctionPointer(), ud);
+ _luaState = NativeMethods.lua_newstate(allocator.ToFunctionPointer(), ud, seed);
+ if (_luaState == IntPtr.Zero)
+ throw new OutOfMemoryException("Could not allocate memory for new Lua state");
SetExtraObject(this, true);
}
@@ -1126,7 +1133,7 @@ public LuaStatus Resume(Lua from, int arguments)
///
public int ResetThread()
{
- return NativeMethods.lua_resetthread(_luaState);
+ return NativeMethods.lua_closethread(_luaState, IntPtr.Zero);
}
///
@@ -1579,7 +1586,7 @@ public void UpValueJoin(int functionIndex1, int n1, int functionIndex2, int n2)
}
///
- /// Return the version of Lua (e.g 504)
+ /// Return the version of Lua (e.g 505)
///
///
public double Version()
@@ -2006,11 +2013,26 @@ public bool NewMetaTable(string name)
}
///
- /// Opens all standard Lua libraries into the given state.
+ /// Opens (loads) and preloads selected standard libraries into the state.
+ ///
+ /// Libraries to load
+ /// Libraries to preload
+ ///
+ /// To preload means to add the library loader into the table package.preload, so that the library can be required later by the program.
+ /// Keep in mind that require itself is provided by the package library.
+ /// If a program does not load that library, it will be unable to require anything.
+ ///
+ public void OpenSelectedLibs(LuaLibrary load, LuaLibrary preload)
+ {
+ NativeMethods.luaL_openselectedlibs(_luaState, load, preload);
+ }
+
+ ///
+ /// Opens all standard Lua libraries into the given state.
///
public void OpenLibs()
{
- NativeMethods.luaL_openlibs(_luaState);
+ OpenSelectedLibs(LuaLibrary.All, LuaLibrary.None);
}
///
@@ -2025,7 +2047,8 @@ public long OptInteger(int argument, long d)
}
///
- /// If the function argument arg is a string, returns this string. If this argument is absent or is nil, returns d ///
+ /// If the function argument arg is a string, returns this string. If this argument is absent or is nil, returns d
+ ///
///
///
///
diff --git a/src/LuaDebug.cs b/src/LuaDebug.cs
index 2cd6de4..d5cb355 100644
--- a/src/LuaDebug.cs
+++ b/src/LuaDebug.cs
@@ -81,6 +81,10 @@ public static LuaDebug FromIntPtr(IntPtr ar)
///
[MarshalAs(UnmanagedType.I1)]
public bool IsVarArg; /* (u) */
+ ///
+ /// number of extra arguments
+ ///
+ public byte NumberExtraArguments;
///
/// true if this function invocation was called by a tail call. In this case, the caller of this level is not in the stack.
///
@@ -90,12 +94,12 @@ public static LuaDebug FromIntPtr(IntPtr ar)
///
/// The index on the stack of the first value being "transferred", that is, parameters in a call or return values in a return. (The other values are in consecutive indices.) Using this index, you can access and modify these values through lua_getlocal and lua_setlocal. This field is only meaningful during a call hook, denoting the first parameter, or a return hook, denoting the first value being returned. (For call hooks, this value is always 1.)
///
- public ushort IndexFirstValue; /* (r) index of first value transferred */
+ public int IndexFirstValue; /* (r) index of first value transferred */
///
/// The number of values being transferred (see previous item). (For calls of Lua functions, this value is always equal to nparams.)
///
- public ushort NumberTransferredValues; /* (r) number of transferred values */
+ public int NumberTransferredValues; /* (r) number of transferred values */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)]
byte[] shortSource;
diff --git a/src/LuaGC.cs b/src/LuaGC.cs
index ef3a899..c5b1729 100644
--- a/src/LuaGC.cs
+++ b/src/LuaGC.cs
@@ -34,26 +34,51 @@ public enum LuaGC
///
Step = 5,
///
- /// The options LUA_GCSETPAUSE and LUA_GCSETSTEPMUL of the function lua_gc are deprecated. You should use the new option LUA_GCINC to set them.
+ /// returns a boolean that tells whether the collector is running
///
- [Obsolete("Deprecatad since Lua 5.4, Use Incremental instead")]
- SetPause = 6,
+ IsRunning = 6,
///
- /// The options LUA_GCSETPAUSE and LUA_GCSETSTEPMUL of the function lua_gc are deprecated. You should use the new option LUA_GCINC to set them.
+ /// Changes the collector to generational mode with the given parameters (see §2.5.2). Returns the previous mode (LUA_GCGEN or LUA_GCINC).
///
- [Obsolete("Deprecatad since Lua 5.4, Use Incremental instead")]
- SetStepMultiplier = 7,
+ Generational = 7,
///
- /// returns a boolean that tells whether the collector is running
+ /// Changes the collector to incremental mode with the given parameters (see §2.5.1). Returns the previous mode (LUA_GCGEN or LUA_GCINC).
///
- IsRunning = 9,
+ Incremental = 8,
///
- /// Changes the collector to generational mode with the given parameters (see §2.5.2). Returns the previous mode (LUA_GCGEN or LUA_GCINC).
+ /// Changes and/or returns the value of a parameter of the collector.
///
- Generational = 10,
+ Parameter = 9,
+ }
+
+ ///
+ /// Garbage Collector operations for use with
+ ///
+ public enum LuaGCParameter
+ {
///
- /// Changes the collector to incremental mode with the given parameters (see §2.5.1). Returns the previous mode (LUA_GCGEN or LUA_GCINC).
+ /// The minor multiplier.
+ ///
+ MinorMultiplier = 0,
+ ///
+ /// The major-minor multiplier.
+ ///
+ MajorMinorMultiplier = 1,
+ ///
+ /// The minor-major multiplier.
+ ///
+ MinorMajorMultiplier = 2,
+ ///
+ /// The garbage-collector pause.
+ ///
+ Pause = 3,
+ ///
+ /// The step multiplier.
+ ///
+ StepMultiplier = 4,
+ ///
+ /// The step size.
///
- Incremental = 11,
+ StepSize = 5,
}
}
diff --git a/src/LuaLibrary.cs b/src/LuaLibrary.cs
new file mode 100644
index 0000000..7d25d1d
--- /dev/null
+++ b/src/LuaLibrary.cs
@@ -0,0 +1,60 @@
+using System;
+
+namespace KeraLua
+{
+ ///
+ /// The lua standard libraries
+ ///
+ [Flags]
+ public enum LuaLibrary
+ {
+ ///
+ /// no library.
+ ///
+ None = 0,
+ ///
+ /// the basic library.
+ ///
+ Basic = 1,
+ ///
+ /// the package library.
+ ///
+ Package = Basic << 1,
+ ///
+ /// the coroutine library.
+ ///
+ Coroutine = Package << 1,
+ ///
+ /// the string library.
+ ///
+ String = Os << 1,
+ ///
+ /// the UTF-8 library.
+ ///
+ Utf8 = Table << 1,
+ ///
+ /// the table library.
+ ///
+ Table = String << 1,
+ ///
+ /// the mathematical library.
+ ///
+ Math = Io << 1,
+ ///
+ /// the I/O library.
+ ///
+ Io = Debug << 1,
+ ///
+ /// the operating system library.
+ ///
+ Os = Math << 1,
+ ///
+ /// the debug library.
+ ///
+ Debug = Coroutine << 1,
+ ///
+ /// all libraries.
+ ///
+ All = ~None,
+ }
+}
diff --git a/src/LuaRegistry.cs b/src/LuaRegistry.cs
index 16bf4f2..474702f 100644
--- a/src/LuaRegistry.cs
+++ b/src/LuaRegistry.cs
@@ -7,11 +7,10 @@
public enum LuaRegistry
#pragma warning restore CA1008 // Enums should have zero value
{
- /* LUAI_MAXSTACK 1000000 */
///
- /// pseudo-index used by registry table
+ /// pseudo-index used by registry table: -1073742823
///
- Index = -1000000 - 1000
+ Index = -(int.MaxValue / 2 + 1000)
}
///
@@ -21,13 +20,15 @@ public enum LuaRegistry
public enum LuaRegistryIndex
#pragma warning restore CA1008 // Enums should have zero value
{
- ///
- /// At this index the registry has the main thread of the state.
- ///
- MainThread = 1,
+ /* index 1 is reserved for the reference mechanism */
+
///
/// At this index the registry has the global environment.
///
Globals = 2,
+ ///
+ /// At this index the registry has the main thread of the state.
+ ///
+ MainThread = 3
}
}
diff --git a/src/Names.txt b/src/Names.txt
index b084294..ed0becb 100644
--- a/src/Names.txt
+++ b/src/Names.txt
@@ -16,6 +16,7 @@ luaL_checkudata
luaL_checkversion_
luaL_error
luaL_execresult
+luaL_alloc
luaL_fileresult
luaL_getmetafield
luaL_getsubtable
@@ -26,7 +27,8 @@ luaL_loadfilex
luaL_loadstring
luaL_newmetatable
luaL_newstate
-luaL_openlibs
+luaL_makeseed
+luaL_openselectedlibs
luaL_optinteger
luaL_optlstring
luaL_optnumber
@@ -80,6 +82,7 @@ lua_len
lua_load
lua_newstate
lua_newthread
+lua_closethread
lua_newuserdata
lua_next
lua_pcallk
@@ -89,6 +92,7 @@ lua_pushfstring
lua_pushinteger
lua_pushlightuserdata
lua_pushlstring
+lua_pushexternalstring
lua_pushnil
lua_pushnumber
lua_pushstring
@@ -117,6 +121,7 @@ lua_settop
lua_setupvalue
lua_setuservalue
lua_status
+lua_numbertocstring
lua_stringtonumber
lua_toboolean
lua_tocfunction
diff --git a/src/NativeMethods.cs b/src/NativeMethods.cs
index dc7316e..aecd2a7 100644
--- a/src/NativeMethods.cs
+++ b/src/NativeMethods.cs
@@ -24,15 +24,15 @@ namespace KeraLua
internal static class NativeMethods
{
#if __IOS__ || __TVOS__ || __WATCHOS__ || __MACCATALYST__
- private const string LuaLibraryName = "@rpath/liblua54.framework/liblua54";
+ private const string LuaLibraryName = "@rpath/liblua55.framework/liblua55";
#elif __ANDROID__
- private const string LuaLibraryName = "liblua54.so";
+ private const string LuaLibraryName = "liblua55.so";
#elif __MACOS__
- private const string LuaLibraryName = "liblua54.dylib";
+ private const string LuaLibraryName = "liblua55.dylib";
#elif WINDOWS_UWP
- private const string LuaLibraryName = "lua54.dll";
+ private const string LuaLibraryName = "lua55.dll";
#else
- private const string LuaLibraryName = "lua54";
+ private const string LuaLibraryName = "lua55";
#endif
#pragma warning disable IDE1006 // Naming Styles
@@ -155,11 +155,14 @@ internal static extern int lua_load
string mode);
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
- internal static extern lua_State lua_newstate(lua_Alloc allocFunction, voidptr_t ud);
+ internal static extern lua_State lua_newstate(lua_Alloc allocFunction, voidptr_t ud, uint seed);
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
internal static extern lua_State lua_newthread(lua_State luaState);
+ [DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern int lua_closethread(lua_State luaState, lua_State from);
+
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
internal static extern voidptr_t lua_newuserdatauv(lua_State luaState, size_t size, int nuvalue);
@@ -190,6 +193,9 @@ internal static extern int lua_pcallk
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
internal static extern charptr_t lua_pushlstring(lua_State luaState, byte[] s, size_t len);
+ [DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern charptr_t lua_pushexternalstring(lua_State luaState, byte[] s, size_t len, lua_Alloc falloc, voidptr_t ud);
+
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
internal static extern void lua_pushnil(lua_State luaState);
@@ -226,9 +232,6 @@ internal static extern int lua_pcallk
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
internal static extern void lua_rawsetp(lua_State luaState, int index, voidptr_t p);
- [DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int lua_resetthread(lua_State luaState);
-
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
internal static extern int lua_resume(lua_State luaState, lua_State from, int nargs, out int results);
@@ -274,6 +277,9 @@ internal static extern int lua_pcallk
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
internal static extern int lua_status(lua_State luaState);
+ [DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern uint lua_numbertocstring(lua_State luaState, int idx, byte[] buff);
+
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern size_t lua_stringtonumber(lua_State luaState, string s);
@@ -370,6 +376,9 @@ internal static extern int lua_yieldk(lua_State luaState,
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
internal static extern int luaL_execresult(lua_State luaState, int stat);
+ [DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern voidptr_t luaL_alloc(voidptr_t ud, voidptr_t ptr, size_t osize, size_t nsize);
+
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern int luaL_fileresult(lua_State luaState, int stat, string fileName);
@@ -400,7 +409,10 @@ internal static extern int luaL_loadbufferx
internal static extern lua_State luaL_newstate();
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
- internal static extern void luaL_openlibs(lua_State luaState);
+ internal static extern uint luaL_makeseed(lua_State luaState);
+
+ [DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
+ internal static extern void luaL_openselectedlibs(lua_State luaState, LuaLibrary load, LuaLibrary preload);
[DllImport(LuaLibraryName, CallingConvention = CallingConvention.Cdecl)]
internal static extern lua_Integer luaL_optinteger(lua_State luaState, int arg, lua_Integer d);
diff --git a/tests/build/net46/KeraLuaTest.csproj b/tests/build/net46/KeraLuaTest.csproj
index 281e9b0..addae5f 100644
--- a/tests/build/net46/KeraLuaTest.csproj
+++ b/tests/build/net46/KeraLuaTest.csproj
@@ -1,4 +1,4 @@
-
+
@@ -98,16 +98,16 @@
-
- lua54.dll
+
+ lua55.dll
PreserveNewest
-
- liblua54.dylib
+
+ liblua55.dylib
PreserveNewest
-
- liblua54.so
+
+ liblua55.so
PreserveNewest
diff --git a/tests/build/net9.0/KeraLuaTest.net9.0.csproj b/tests/build/net9.0/KeraLuaTest.net9.0.csproj
index 6b08197..df56c60 100644
--- a/tests/build/net9.0/KeraLuaTest.net9.0.csproj
+++ b/tests/build/net9.0/KeraLuaTest.net9.0.csproj
@@ -76,16 +76,16 @@
-
- lua54.dll
+
+ lua55.dll
PreserveNewest
-
- liblua54.dylib
+
+ liblua55.dylib
PreserveNewest
-
- liblua54.so
+
+ liblua55.so
PreserveNewest