Skip to content

Commit a09be23

Browse files
committed
Changed static readonly to const
1 parent 31366f7 commit a09be23

File tree

5 files changed

+355
-355
lines changed

5 files changed

+355
-355
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Lua.NET
2-
![Logo](Lua.NET.Logo.png)
2+
![Logo](https://raw.githubusercontent.com/tilkinsc/Lua.NET/main/Lua.NET.Logo.png)
33

44
C# .NET Core 6.0 Lua bindings and helper functions.
55

src/Lua51.cs

+64-64
Original file line numberDiff line numberDiff line change
@@ -9,68 +9,68 @@ public static class Lua
99

1010
private const string DllName = "Lua515.dll";
1111

12-
public static readonly string LUA_LDIR = "!\\lua\\";
13-
public static readonly string LUA_CDIR = "!\\";
14-
public static readonly string LUA_PATH_DEFAULT = ".\\?.lua;" + LUA_LDIR + "?.lua;" + LUA_LDIR + "?\\init.lua;" + LUA_CDIR + "?.lua;" + LUA_CDIR + "?\\init.lua";
15-
public static readonly string LUA_CPATH_DEFAULT = ".\\?.dll;" + LUA_CDIR + "?.dll;" + LUA_CDIR + "loadall.dll";
12+
public const string LUA_LDIR = "!\\lua\\";
13+
public const string LUA_CDIR = "!\\";
14+
public const string LUA_PATH_DEFAULT = ".\\?.lua;" + LUA_LDIR + "?.lua;" + LUA_LDIR + "?\\init.lua;" + LUA_CDIR + "?.lua;" + LUA_CDIR + "?\\init.lua";
15+
public const string LUA_CPATH_DEFAULT = ".\\?.dll;" + LUA_CDIR + "?.dll;" + LUA_CDIR + "loadall.dll";
1616

17-
public static readonly string LUA_DIRSEP = "\\";
17+
public const string LUA_DIRSEP = "\\";
1818

19-
public static readonly string LUA_PATHSEP = ";";
20-
public static readonly string LUA_PATH_MARK = "?";
21-
public static readonly string LUA_EXECDIR = "!";
22-
public static readonly string LUA_IGMARK = "-";
19+
public const string LUA_PATHSEP = ";";
20+
public const string LUA_PATH_MARK = "?";
21+
public const string LUA_EXECDIR = "!";
22+
public const string LUA_IGMARK = "-";
2323

24-
public static readonly int LUA_IDSIZE = 60;
24+
public const int LUA_IDSIZE = 60;
2525

26-
public static readonly int LUAI_MAXCALLS = 20000;
27-
public static readonly int LUAI_MAXCSTACK = 8000;
28-
public static readonly int LUAI_BITSINT = 32;
29-
public static readonly int LUAI_MAXCCALLS = 200;
30-
public static readonly int LUAI_MAXVARS = 200;
31-
public static readonly int LUAI_MAXUPVALUES = 60;
32-
public static readonly int LUAL_BUFFERSIZE = 512;
26+
public const int LUAI_MAXCALLS = 20000;
27+
public const int LUAI_MAXCSTACK = 8000;
28+
public const int LUAI_BITSINT = 32;
29+
public const int LUAI_MAXCCALLS = 200;
30+
public const int LUAI_MAXVARS = 200;
31+
public const int LUAI_MAXUPVALUES = 60;
32+
public const int LUAL_BUFFERSIZE = 512;
3333

34-
public static readonly int LUA_MAXCAPTURES = 32;
34+
public const int LUA_MAXCAPTURES = 32;
3535

36-
public static readonly string LUA_VERSION = "Lua 5.1";
37-
public static readonly string LUA_RELEASE = "Lua 5.1.5";
38-
public static readonly int LUA_VERSION_NUM = 501;
39-
public static readonly string LUA_COPYRIGHT = "Copyright (C) 1994-2012 Lua.org, PUC-Rio";
40-
public static readonly string LUA_AUTHORS = "R. Ierusalimschy, L. H. de Figueiredo & W. Celes";
36+
public const string LUA_VERSION = "Lua 5.1";
37+
public const string LUA_RELEASE = "Lua 5.1.5";
38+
public const int LUA_VERSION_NUM = 501;
39+
public const string LUA_COPYRIGHT = "Copyright (C) 1994-2012 Lua.org, PUC-Rio";
40+
public const string LUA_AUTHORS = "R. Ierusalimschy, L. H. de Figueiredo & W. Celes";
4141

4242
// TODO: \033Lua
43-
public static readonly string LUA_SIGNATURE = "\x1bLua";
43+
public const string LUA_SIGNATURE = "\x1bLua";
4444

45-
public static readonly int LUA_MULTRET = -1;
45+
public const int LUA_MULTRET = -1;
4646

47-
public static readonly int LUA_REGISTRYINDEX = -10000;
48-
public static readonly int LUA_ENVIRONINDEX = -10001;
49-
public static readonly int LUA_GLOBALSINDEX = -10002;
47+
public const int LUA_REGISTRYINDEX = -10000;
48+
public const int LUA_ENVIRONINDEX = -10001;
49+
public const int LUA_GLOBALSINDEX = -10002;
5050

5151
public static int lua_upvalueindex(int i)
5252
{
5353
return LUA_GLOBALSINDEX - i;
5454
}
5555

56-
public static readonly int LUA_YIELD = 1;
57-
public static readonly int LUA_ERRRUN = 2;
58-
public static readonly int LUA_ERRSYNTAX = 3;
59-
public static readonly int LUA_ERRMEM = 4;
60-
public static readonly int LUA_ERRERR = 5;
56+
public const int LUA_YIELD = 1;
57+
public const int LUA_ERRRUN = 2;
58+
public const int LUA_ERRSYNTAX = 3;
59+
public const int LUA_ERRMEM = 4;
60+
public const int LUA_ERRERR = 5;
6161

62-
public static readonly int LUA_TNONE = -1;
63-
public static readonly int LUA_TNIL = 0;
64-
public static readonly int LUA_TBOOLEAN = 1;
65-
public static readonly int LUA_TLIGHTUSERDATA = 2;
66-
public static readonly int LUA_TNUMBER = 3;
67-
public static readonly int LUA_TSTRING = 4;
68-
public static readonly int LUA_TTABLE = 5;
69-
public static readonly int LUA_TFUNCTION = 6;
70-
public static readonly int LUA_TUSERDATA = 7;
71-
public static readonly int LUA_TTHREAD = 8;
62+
public const int LUA_TNONE = -1;
63+
public const int LUA_TNIL = 0;
64+
public const int LUA_TBOOLEAN = 1;
65+
public const int LUA_TLIGHTUSERDATA = 2;
66+
public const int LUA_TNUMBER = 3;
67+
public const int LUA_TSTRING = 4;
68+
public const int LUA_TTABLE = 5;
69+
public const int LUA_TFUNCTION = 6;
70+
public const int LUA_TUSERDATA = 7;
71+
public const int LUA_TTHREAD = 8;
7272

73-
public static readonly int LUA_MINSTACK = 20;
73+
public const int LUA_MINSTACK = 20;
7474

7575
[DllImport(DllName, CallingConvention = CallingConvention.StdCall)]
7676
public static extern IntPtr lua_newstate(lua_Alloc f, IntPtr ud);
@@ -275,14 +275,14 @@ public static int lua_upvalueindex(int i)
275275
[DllImport(DllName, CallingConvention = CallingConvention.StdCall)]
276276
public static extern int lua_status(IntPtr L);
277277

278-
public static readonly int LUA_GCSTOP = 0;
279-
public static readonly int LUA_GCRESTART = 1;
280-
public static readonly int LUA_GCCOLLECT = 2;
281-
public static readonly int LUA_GCCOUNT = 3;
282-
public static readonly int LUA_GCCOUNTB = 4;
283-
public static readonly int LUA_GCSTEP = 5;
284-
public static readonly int LUA_GCSETPAUSE = 6;
285-
public static readonly int LUA_GCSETSTEPMUL = 7;
278+
public const int LUA_GCSTOP = 0;
279+
public const int LUA_GCRESTART = 1;
280+
public const int LUA_GCCOLLECT = 2;
281+
public const int LUA_GCCOUNT = 3;
282+
public const int LUA_GCCOUNTB = 4;
283+
public const int LUA_GCSTEP = 5;
284+
public const int LUA_GCSETPAUSE = 6;
285+
public const int LUA_GCSETSTEPMUL = 7;
286286

287287
[DllImport(DllName, CallingConvention = CallingConvention.StdCall)]
288288
public static extern int lua_gc(IntPtr L, int what, int data);
@@ -407,16 +407,16 @@ public static int lua_getgccount(IntPtr L)
407407
[DllImport(DllName, CallingConvention = CallingConvention.StdCall)]
408408
public static extern void lua_setlevel(IntPtr from, IntPtr to);
409409

410-
public static readonly int LUA_HOOKCALL = 0;
411-
public static readonly int LUA_HOOKRET = 1;
412-
public static readonly int LUA_HOOKLINE = 2;
413-
public static readonly int LUA_HOOKCOUNT = 3;
414-
public static readonly int LUA_HOOKTAILRET = 4;
410+
public const int LUA_HOOKCALL = 0;
411+
public const int LUA_HOOKRET = 1;
412+
public const int LUA_HOOKLINE = 2;
413+
public const int LUA_HOOKCOUNT = 3;
414+
public const int LUA_HOOKTAILRET = 4;
415415

416-
public static readonly int LUA_MASKCALL = (1 << LUA_HOOKCALL);
417-
public static readonly int LUA_MASKRET = (1 << LUA_HOOKRET);
418-
public static readonly int LUA_MASKLINE = (1 << LUA_HOOKLINE);
419-
public static readonly int LUA_MASKCOUNT = (1 << LUA_HOOKCOUNT);
416+
public const int LUA_MASKCALL = (1 << LUA_HOOKCALL);
417+
public const int LUA_MASKRET = (1 << LUA_HOOKRET);
418+
public const int LUA_MASKLINE = (1 << LUA_HOOKLINE);
419+
public const int LUA_MASKCOUNT = (1 << LUA_HOOKCOUNT);
420420

421421
[DllImport(DllName, CallingConvention = CallingConvention.StdCall)]
422422
public static extern int lua_getstack(IntPtr L, int level, lua_Debug ar);
@@ -502,7 +502,7 @@ public static ulong luaL_getn(IntPtr L, int i)
502502
return lua_objlen(L, i);
503503
}
504504

505-
public static readonly int LUA_ERRFILE = LUA_ERRERR + 1;
505+
public const int LUA_ERRFILE = LUA_ERRERR + 1;
506506

507507
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
508508
public struct luaL_Reg {
@@ -579,8 +579,8 @@ public struct luaL_Reg {
579579
[DllImport(DllName, CallingConvention = CallingConvention.StdCall)]
580580
public static extern int luaL_checkoption(IntPtr L, int narg, string def, string[][] lst);
581581

582-
public static readonly int LUA_NOREF = -2;
583-
public static readonly int LUA_REFNIL = -1;
582+
public const int LUA_NOREF = -2;
583+
public const int LUA_REFNIL = -1;
584584

585585
[DllImport(DllName, CallingConvention = CallingConvention.StdCall)]
586586
public static extern int luaL_ref(IntPtr L, int t);

0 commit comments

Comments
 (0)