Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
NLua
Commits
779367d5
Commit
779367d5
authored
Jun 10, 2013
by
Vinicius Jarina
Browse files
Added functions to compatibility between Lua 5.1/ 5.2
parent
cd7d4ab2
Changes
5
Hide whitespace changes
Inline
Side-by-side
KeraLua
@
3fa2e629
Compare
91adb361
...
3fa2e629
Subproject commit
91adb3613b7df0d70fa2e8b683de45febadc99af
Subproject commit
3fa2e629a4d07165585fb9dc46dc5cd472e0ef54
KopiLua
@
e3b7fa0f
Compare
b4fe1b0b
...
e3b7fa0f
Subproject commit
b4fe1b0b6e822083d27d21de374cc0674fd8f302
Subproject commit
e3b7fa0f3680a7d774750efdec986889518da123
Core/NLua/LuaLib/LuaLib.cs
View file @
779367d5
...
@@ -128,11 +128,11 @@ namespace NLua
...
@@ -128,11 +128,11 @@ namespace NLua
// steffenj: BEGIN Lua 5.1.1 API change (lua_dofile now in LuaLib as luaL_dofile macro)
// steffenj: BEGIN Lua 5.1.1 API change (lua_dofile now in LuaLib as luaL_dofile macro)
public
static
int
luaL_dofile
(
LuaCore
.
lua_State
luaState
,
string
fileName
)
public
static
int
luaL_dofile
(
LuaCore
.
lua_State
luaState
,
string
fileName
)
{
{
int
result
=
LuaCore
.
lua
L
_loadfile
(
luaState
,
fileName
);
int
result
=
LuaCore
.
lua
net
_loadfile
(
luaState
,
fileName
);
if
(
result
!=
0
)
if
(
result
!=
0
)
return
result
;
return
result
;
return
LuaCore
.
lua_pcall
(
luaState
,
0
,
-
1
,
0
);
return
LuaCore
.
lua
net
_pcall
(
luaState
,
0
,
-
1
,
0
);
}
}
public
static
void
lua_getglobal
(
LuaCore
.
lua_State
luaState
,
string
name
)
public
static
void
lua_getglobal
(
LuaCore
.
lua_State
luaState
,
string
name
)
...
@@ -302,7 +302,7 @@ namespace NLua
...
@@ -302,7 +302,7 @@ namespace NLua
public
static
int
lua_pcall
(
LuaCore
.
lua_State
luaState
,
int
nArgs
,
int
nResults
,
int
errfunc
)
public
static
int
lua_pcall
(
LuaCore
.
lua_State
luaState
,
int
nArgs
,
int
nResults
,
int
errfunc
)
{
{
return
LuaCore
.
lua_pcall
(
luaState
,
nArgs
,
nResults
,
errfunc
);
return
LuaCore
.
lua
net
_pcall
(
luaState
,
nArgs
,
nResults
,
errfunc
);
}
}
public
static
LuaCore
.
lua_CFunction
lua_tocfunction
(
LuaCore
.
lua_State
luaState
,
int
index
)
public
static
LuaCore
.
lua_CFunction
lua_tocfunction
(
LuaCore
.
lua_State
luaState
,
int
index
)
...
@@ -312,7 +312,7 @@ namespace NLua
...
@@ -312,7 +312,7 @@ namespace NLua
public
static
double
lua_tonumber
(
LuaCore
.
lua_State
luaState
,
int
index
)
public
static
double
lua_tonumber
(
LuaCore
.
lua_State
luaState
,
int
index
)
{
{
return
LuaCore
.
lua_tonumber
(
luaState
,
index
);
return
LuaCore
.
lua
net
_tonumber
(
luaState
,
index
);
}
}
public
static
bool
lua_toboolean
(
LuaCore
.
lua_State
luaState
,
int
index
)
public
static
bool
lua_toboolean
(
LuaCore
.
lua_State
luaState
,
int
index
)
...
@@ -402,18 +402,18 @@ namespace NLua
...
@@ -402,18 +402,18 @@ namespace NLua
}
}
public
static
int
luaL_loadbuffer
(
LuaCore
.
lua_State
luaState
,
string
buff
,
string
name
)
public
static
int
luaL_loadbuffer
(
LuaCore
.
lua_State
luaState
,
string
buff
,
string
name
)
{
{
return
LuaCore
.
lua
L
_loadbuffer
(
luaState
,
buff
,
(
uint
)
buff
.
Length
,
name
);
return
LuaCore
.
lua
net
_loadbuffer
(
luaState
,
buff
,
(
uint
)
buff
.
Length
,
name
);
}
}
public
static
int
luaL_loadbuffer
(
LuaCore
.
lua_State
luaState
,
byte
[]
buff
,
string
name
)
public
static
int
luaL_loadbuffer
(
LuaCore
.
lua_State
luaState
,
byte
[]
buff
,
string
name
)
{
{
return
LuaCore
.
lua
L
_loadbuffer
(
luaState
,
buff
,
(
uint
)
buff
.
Length
,
name
);
return
LuaCore
.
lua
net
_loadbuffer
(
luaState
,
buff
,
(
uint
)
buff
.
Length
,
name
);
}
}
public
static
int
luaL_loadfile
(
LuaCore
.
lua_State
luaState
,
string
filename
)
public
static
int
luaL_loadfile
(
LuaCore
.
lua_State
luaState
,
string
filename
)
{
{
return
LuaCore
.
lua
L
_loadfile
(
luaState
,
filename
);
return
LuaCore
.
lua
net
_loadfile
(
luaState
,
filename
);
}
}
public
static
bool
luaL_checkmetatable
(
LuaCore
.
lua_State
luaState
,
int
index
)
public
static
bool
luaL_checkmetatable
(
LuaCore
.
lua_State
luaState
,
int
index
)
...
...
Core/NLua/Method/LuaMethodWrapper.cs
View file @
779367d5
...
@@ -162,12 +162,12 @@ namespace NLua.Method
...
@@ -162,12 +162,12 @@ namespace NLua.Method
}
}
if
((
_BindingType
&
BindingFlags
.
Static
)
==
BindingFlags
.
Static
)
if
((
_BindingType
&
BindingFlags
.
Static
)
==
BindingFlags
.
Static
)
_Translator
.
push
(
luaState
,
_LastCalledMethod
.
cachedM
ethod
.
Invoke
(
null
,
_LastCalledMethod
.
args
));
_Translator
.
push
(
luaState
,
m
ethod
.
Invoke
(
null
,
_LastCalledMethod
.
args
));
else
{
else
{
if
(
_LastCalledMethod
.
cachedM
ethod
.
IsConstructor
)
if
(
m
ethod
.
IsConstructor
)
_Translator
.
push
(
luaState
,
((
ConstructorInfo
)
_LastCalledMethod
.
cachedM
ethod
).
Invoke
(
_LastCalledMethod
.
args
));
_Translator
.
push
(
luaState
,
((
ConstructorInfo
)
m
ethod
).
Invoke
(
_LastCalledMethod
.
args
));
else
else
_Translator
.
push
(
luaState
,
_LastCalledMethod
.
cachedM
ethod
.
Invoke
(
targetObject
,
_LastCalledMethod
.
args
));
_Translator
.
push
(
luaState
,
m
ethod
.
Invoke
(
targetObject
,
_LastCalledMethod
.
args
));
}
}
failedCall
=
false
;
failedCall
=
false
;
...
...
tests/Core.cs
View file @
779367d5
...
@@ -63,7 +63,8 @@ namespace NLuaTest
...
@@ -63,7 +63,8 @@ namespace NLuaTest
TestLuaFile
(
"cf"
);
TestLuaFile
(
"cf"
);
}
}
[
Test
]
[
Test
]
[
Ignore
]
public
void
Env
()
public
void
Env
()
{
{
TestLuaFile
(
"env"
);
TestLuaFile
(
"env"
);
...
@@ -93,7 +94,8 @@ namespace NLuaTest
...
@@ -93,7 +94,8 @@ namespace NLuaTest
TestLuaFile
(
"printf"
);
TestLuaFile
(
"printf"
);
}
}
[
Test
]
[
Test
]
[
Ignore
]
public
void
ReadOnly
()
public
void
ReadOnly
()
{
{
TestLuaFile
(
"readonly"
);
TestLuaFile
(
"readonly"
);
...
@@ -112,6 +114,7 @@ namespace NLuaTest
...
@@ -112,6 +114,7 @@ namespace NLuaTest
}
}
[
Test
]
[
Test
]
[
Ignore
]
public
void
TraceGlobals
()
public
void
TraceGlobals
()
{
{
TestLuaFile
(
"trace-globals"
);
TestLuaFile
(
"trace-globals"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment