Coder Social home page Coder Social logo

pangweiwei / slua Goto Github PK

View Code? Open in Web Editor NEW
1.4K 1.4K 439.0 48.01 MB

Fastest lua binding via static code generating for Unity3D and mono.

License: MIT License

C# 33.32% C 39.47% Makefile 0.83% HTML 18.35% CSS 0.11% C++ 0.63% Batchfile 0.17% Lua 0.16% Shell 0.16% Roff 0.47% CMake 6.33%

slua's People

Contributors

chnkd avatar dayongxie avatar debugclub avatar finger86 avatar go3k avatar ialex32x avatar ijovi23 avatar jiangzhhhh avatar ladepensy avatar lailongwei avatar luzexi avatar lwkl avatar magicqy avatar mr-kelly avatar noeticwxb avatar pangame avatar pangweiwei avatar pitfulpeas avatar playermet avatar qiankanglai avatar roland0511 avatar salada avatar shawnscode avatar shenxiyou avatar shrimpz avatar slb1988 avatar veboys avatar wlgys8 avatar yaukeywang avatar yongkangchen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slua's Issues

How To Call ToString () methods from Lua?

HI,
I am trying to do something like this:

Debug.Log ("Object position: " .. self.go.transform.position);

to print the position of my gameobject, however it is trying to concatenate the actual Vector3 to "Object position: ", as opposed to the ToStringed version of the vector3.

Slua also can not seem to find the ToString methods if I try "Debug.Log ("Object position: " ... self.go.transform.position.ToString ()), or position:ToString().

The only way I am able to print the vector normally is Debug.Log (self.go.transform.position). print(self.go.transform.position) just prints the memory/table address as well, which is not desired.

Is there anyway to grab the ToString from a c# script/object member?

EDIT: Larger question: How do I access (or generate code for) the System namespace/functions from LuaJit so that I can use System.* classes?

当lua脚本有语法错误的时候,无法显示错误信息和行数

执行:

local a = -1

期望报错:

lua: test.lua:2: unexpected symbol near char(239)

实际报错:

attempt to concatenate a nil value
stack traceback:
    [C]: ?
    [C]: in function 'require'
    [string "game"]:2: in main chunk
    [C]: in function 'require'
    [string "main"]:63: in function <[string "main"]:58>
UnityEngine.Debug:LogError(Object)
SLua.LuaState:errorReport(IntPtr) (at Assets/Slua/Script/LuaState.cs:583)
LuaInterface.LuaDLL:lua_concat(IntPtr, Int32)
LuaInterface.LuaDLL:luaL_error(IntPtr, String) (at Assets/Slua/Script/LuaDLL.cs:149)
SLua.LuaState:loader(IntPtr) (at Assets/Slua/Script/LuaState.cs:698)
LuaInterface.LuaDLL:lua_pcall(IntPtr, Int32, Int32, Int32)
SLua.LuaFunction:call(Int32, Int32) (at Assets/Slua/Script/LuaState.cs:162)
SLua.LuaFunction:innerCall(Int32, Int32) (at Assets/Slua/Script/LuaState.cs:172)
SLua.LuaFunction:call() (at Assets/Slua/Script/LuaState.cs:181)
SLua.LuaSvr:start(String) (at Assets/Slua/Script/LuaSvr.cs:91)
SLua.LuaSvr:.ctor(String) (at Assets/Slua/Script/LuaSvr.cs:75)
Main:Start() (at Assets/Scripts/Main.cs:36)

strict.lua check failed when debugging with DebugInterface。

We are using strict.lua to check if any global is used without declaration.

SLuaDebug.cs line 107 fails the check.

local function buildEnv()
        local localEnv = setmetatable({}, {__index=_G})
        local setVariable = _G  --local keyword should be added
...

BTW How about debugging lua with zeroBrane ?

conflict slua with UNetWeaver in Unity 5.2.x

I see this issue http://www.unityqa.com/?/article/5 and i was suffered same issue at post.

when i attempt to upgrade unity 5.2.2, if Assembly-CSharp.dll or Assembly-CSharp-fistpass.dll size is much big, this issue is occured. ( but information is lack and uncertain )

I think this issue is only caused by UNetWeaver. because this option is not possibly switched turn on-off in unity, in addition, UNetWeaver use too many reflection for making inner structure.

but our project need fast workaround solution, then choose below it.

i don't hope to accept my solution.
this issue only suggestion for sharing necessity that Assembly-CSharp.dll binary size must be reduced.

thanks.

coroutine.resume crash unity

test.lua

local x = nil
x()

main.lua

function main()
    local co
    co = coroutine.create(function()
        LuaTimer.Add(1000, function()
            coroutine.resume(co)
        end)

        coroutine.yield()

        dofile "test"
    end)
    coroutine.resume(co)
end

Editor.log:

Receiving unhandled NULL exception
Launching bug reporter
Obtained 59 stack frames.
#0  0x00000004887bb6 in mono_arch_find_jit_info_ext
#1  0x0000000484dddb in mono_find_jit_info
#2  0x0000000484dc7c in mono_find_jit_info
#3  0x0000000484e7dc in mono_jit_walk_stack_from_ctx
#4  0x0000000484e904 in mono_jit_walk_stack
#5  0x000000048d338d in mono_method_get_last_managed
#6  0x000000009609e2 in ExtractMonoStacktrace(std::string const&, std::string&, std::string&, int, std::string&, int*, int, int)
#7  0x00000000abd556 in DebugStringToFile(char const*, int, char const*, int, int, int, int)
#8  0x00000000f4a0d0 in Debug_CUSTOM_Internal_Log(int, ICallString, ScriptingObjectOfType<Object>)
#9  0x000000271f36c8 in  (wrapper managed-to-native) UnityEngine.Debug:Internal_Log (int,string,UnityEngine.Object) + 0x50 (0x271f3678 0x271f371b) [0x8e87a80 - Unity Child Domain]
#10 0x000000271f3651 in  UnityEngine.Debug:LogError (object) + 0x71 (0x271f35e0 0x271f3668) [0x8e87a80 - Unity Child Domain]
#11 0x000000271f3373 in  Lua_UnityEngine_Debug:LogError_s (intptr) + 0xbb (0x271f32b8 0x271f3544) [0x8e87a80 - Unity Child Domain]
#12 0x00000022f2b619 in  (wrapper native-to-managed) Lua_UnityEngine_Debug:LogError_s (intptr) + 0x91 (0x22f2b588 0x22f2b648) [0x8e87a80 - Unity Child Domain]
#13 0x00000022d2e58d in luaD_precall
#14 0x00000022d24aff in luaV_execute
#15 0x00000022d2e9eb in luaD_call
#16 0x00000022d29081 in f_call
#17 0x00000022d2e123 in luaD_rawrunprotected
#18 0x00000022d2ec40 in luaD_pcall
#19 0x00000022d29045 in lua_pcall
#20 0x0000001d407728 in  (wrapper managed-to-native) LuaInterface.LuaDLL:lua_pcall (intptr,int,int,int) + 0x80 (0x1d4076a8 0x1d40778d) [0x8e87a80 - Unity Child Domain]
#21 0x0000002325491b in  SLua.LuaFunction:call (int,int) + 0x193 (0x23254788 0x23254978) [0x8e87a80 - Unity Child Domain]
#22 0x000000271f2da8 in  SLua.LuaTimer/<Add>c__AnonStorey4B:<>m__4F (int) + 0x80 (0x271f2d28 0x271f2de2) [0x8e87a80 - Unity Child Domain]
#23 0x000000271f2d0c in  SLua.LuaTimer/<add>c__AnonStorey4A:<>m__4E (int) + 0x2c (0x271f2ce0 0x271f2d25) [0x8e87a80 - Unity Child Domain]
#24 0x0000002325c2bd in  SLua.LuaTimer:tick (single) + 0x5c5 (0x2325bcf8 0x2325c394) [0x8e87a80 - Unity Child Domain]
#25 0x0000002325ba85 in  SLua.LuaSvr:tick () + 0x115 (0x2325b970 0x2325ba9c) [0x8e87a80 - Unity Child Domain]
#26 0x0000002325b956 in  SLua.LuaSvrGameObject:Update () + 0x3e (0x2325b918 0x2325b96d) [0x8e87a80 - Unity Child Domain]
#27 0x00000018195b4f in  (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) + 0x8f (0x18195ac0 0x18195c1a) [0x8e87a80 - Unity Child Domain]
#28 0x000000047d5a16 in mono_get_runtime_build_info
#29 0x000000049094b7 in mono_runtime_invoke
#30 0x00000000730b0c in scripting_method_invoke(ScriptingMethodMono, MonoObject*, ScriptingArguments&, MonoException**)
#31 0x0000000097aec1 in ScriptingInvocationNoArgs::Invoke(MonoException**)
#32 0x0000000097ae1e in ScriptingInvocationNoArgs::Invoke()
#33 0x0000000095f5fa in MonoBehaviour::CallMethodIfAvailable(int)
#34 0x00000000959e7a in MonoBehaviour::CallUpdateMethod(int)
#35 0x00000000959ea9 in MonoBehaviour::Update()
#36 0x000000006fdfd0 in void BaseBehaviourManager::CommonUpdate<BehaviourManager>()
#37 0x00000000871367 in PlayerLoop(bool, bool, IHookEvent*)
#38 0x000000014d4c19 in Application::UpdateScene(bool)
#39 0x000000014d11c9 in Application::UpdateSceneIfNeeded()
#40 0x000000014d0209 in Application::TickTimer()
#41 0x000000016c2168 in -[EditorApplication TickTimer]
#42 0x00000099e2c6cf in __NSFireTimer
#43 0x0000009b6ac006 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
#44 0x0000009b6abab4 in __CFRunLoopDoTimer
#45 0x0000009b72754f in __CFRunLoopDoTimers
#46 0x0000009b663531 in __CFRunLoopRun
#47 0x0000009b662aa6 in CFRunLoopRunSpecific
#48 0x0000009b66290b in CFRunLoopRunInMode
#49 0x0000009746f8f8 in RunCurrentEventLoopInMode
#50 0x0000009746f631 in ReceiveNextEventCommon
#51 0x0000009746f42c in _BlockUntilNextEventMatchingListInModeWithFilter
#52 0x00000090bd8721 in _DPSNextEvent
#53 0x00000090bd7dc5 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#54 0x00000090bcc77c in -[NSApplication run]
#55 0x00000090b41bc0 in NSApplicationMain
#56 0x000000016d78bb in EditorMain(int, char const**)
#57 0x000000016d7ff8 in main
#58 0x00000000003435 in start

*** Launching bug reporter due to crashbug.
Obtained 65 stack frames.
0   Unity                               0x016ba271 _Z17LaunchBugReporter13BugReportMode + 1073
1   Unity                               0x009654a5 _Z12HandleSignaliP9__siginfoPv + 53
2   libmono.0.dylib                     0x0488981a mono_chain_signal + 76
3   libmono.0.dylib                     0x047d3ae2 mono_sigsegv_signal_handler + 234
4   libsystem_platform.dylib            0x900e503b _sigtramp + 43
5   ???                                 0xffffffff 0x0 + 4294967295
6   libmono.0.dylib                     0x0484dddb mono_find_jit_info + 471
7   libmono.0.dylib                     0x0484dc7c mono_find_jit_info + 120
8   libmono.0.dylib                     0x0484e7dc mono_jit_walk_stack_from_ctx + 292
9   libmono.0.dylib                     0x0484e904 mono_jit_walk_stack + 45
10  libmono.0.dylib                     0x048d338d mono_method_get_last_managed + 57
11  Unity                               0x009609e2 _ZL21ExtractMonoStacktraceRKSsRSsS1_iS1_Piii + 50
12  Unity                               0x00abd556 _Z17DebugStringToFilePKciS0_iiii + 198
13  Unity                               0x00f4a0d0 _Z25Debug_CUSTOM_Internal_Logi11ICallString21ScriptingObjectOfTypeI6ObjectE + 128
14  ???                                 0x271f36c8 0x0 + 656357064
15  ???                                 0x271f3651 0x0 + 656356945
16  ???                                 0x271f3373 0x0 + 656356211
17  ???                                 0x22f2b619 0x0 + 586331673
18  slua                                0x22d2e58d luaD_precall + 543
19  slua                                0x22d24aff luaV_execute + 1876
20  slua                                0x22d2e9eb luaD_call + 108
21  slua                                0x22d29081 f_call + 33
22  slua                                0x22d2e123 luaD_rawrunprotected + 59
23  slua                                0x22d2ec40 luaD_pcall + 66
24  slua                                0x22d29045 lua_pcall + 99
25  ???                                 0x1d407728 0x0 + 490764072
26  ???                                 0x2325491b 0x0 + 589646107
27  ???                                 0x271f2da8 0x0 + 656354728
28  ???                                 0x271f2d0c 0x0 + 656354572
29  ???                                 0x2325c2bd 0x0 + 589677245
30  ???                                 0x2325ba85 0x0 + 589675141
31  ???                                 0x2325b956 0x0 + 589674838
32  ???                                 0x18195b4f 0x0 + 404314959
33  libmono.0.dylib                     0x047d5a16 mono_get_runtime_build_info + 3344
34  libmono.0.dylib                     0x049094b7 mono_runtime_invoke + 133
35  Unity                               0x00730b0c _Z23scripting_method_invoke19ScriptingMethodMonoP10MonoObjectR18ScriptingArgumentsPP13MonoException + 60
36  Unity                               0x0097aec1 _ZN25ScriptingInvocationNoArgs6InvokeEPP13MonoException + 145
37  Unity                               0x0097ae1e _ZN25ScriptingInvocationNoArgs6InvokeEv + 30
38  Unity                               0x0095f5fa _ZN13MonoBehaviour21CallMethodIfAvailableEi + 458
39  Unity                               0x00959e7a _ZN13MonoBehaviour16CallUpdateMethodEi + 314
40  Unity                               0x00959ea9 _ZN13MonoBehaviour6UpdateEv + 25
41  Unity                               0x006fdfd0 _ZN20BaseBehaviourManager12CommonUpdateI16BehaviourManagerEEvv + 448
42  Unity                               0x00871367 _Z10PlayerLoopbbP10IHookEvent + 1639
43  Unity                               0x014d4c19 _ZN11Application11UpdateSceneEb + 457
44  Unity                               0x014d11c9 _ZN11Application19UpdateSceneIfNeededEv + 73
45  Unity                               0x014d0209 _ZN11Application9TickTimerEv + 2057
46  Unity                               0x016c2168 -[EditorApplication TickTimer] + 24
47  Foundation                          0x99e2c6cf __NSFireTimer + 119
48  CoreFoundation                      0x9b6ac006 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
49  CoreFoundation                      0x9b6abab4 __CFRunLoopDoTimer + 1316
50  CoreFoundation                      0x9b72754f __CFRunLoopDoTimers + 351
51  CoreFoundation                      0x9b663531 __CFRunLoopRun + 2081
52  CoreFoundation                      0x9b662aa6 CFRunLoopRunSpecific + 390
53  CoreFoundation                      0x9b66290b CFRunLoopRunInMode + 123
54  HIToolbox                           0x9746f8f8 RunCurrentEventLoopInMode + 262
55  HIToolbox                           0x9746f631 ReceiveNextEventCommon + 494
56  HIToolbox                           0x9746f42c _BlockUntilNextEventMatchingListInModeWithFilter + 99
57  AppKit                              0x90bd8721 _DPSNextEvent + 742
58  AppKit                              0x90bd7dc5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 350
59  AppKit                              0x90bcc77c -[NSApplication run] + 907
60  AppKit                              0x90b41bc0 NSApplicationMain + 2082
61  Unity                               0x016d78bb _Z10EditorMainiPPKc + 1339
62  Unity                               0x016d7ff8 main + 24
63  Unity                               0x00003435 start + 53
64  ???                                 0x00000001 0x0 + 1
Stacktrace:

  at (wrapper managed-to-native) UnityEngine.Debug.Internal_Log (int,string,UnityEngine.Object) <0x00004>
  at (wrapper managed-to-native) UnityEngine.Debug.Internal_Log (int,string,UnityEngine.Object) <0x00004>

Need export UnityEvent with more than one argument

We have some UnityEvent with more than one argument.
As follows

    public class ListViewEvent : UnityEvent<int,string> {

    }

SLua seems to only support those with only one argument

    static public void reg(IntPtr l) {
        LuaUnityEvent_int_string.reg(l); // <-- compiler complains about this line
        getTypeTable(l,"UIWidgets.ListViewEvent");
        createTypeMetatable(l,constructor, typeof(UIWidgets.ListViewEvent),typeof(UnityEngine.Events.UnityEvent<System.Int32,System.String>));
    }

Mac与Win上生成自定义类代码 endline的问题

我看LuaCodeGen里面,是用file.WriteLine()来写入.
这导致利用mac生成的Custom class和利用win生成的custom class由于换行符的不同而产生冲突。
这在跨平台svn协作的时候产生比较大的问题。
是否改成统一的endline比较好呢?
比如
file.WriteLine(fmt) == >file.Write(fmt); file.Write("\r\n");

Issues with variable args number

  1. Overloaded methods with different args number and params used comparison number of args, instead of matchType or something else.
    Reproduce example:
    public void func6(string str, params object[] args) {}
    public void func6(string str, int a, params object[] args) {}

  2. Overloaded methods with params argument handled with matchType as plain array. As result, caused 'No matched override function to call' error.
    Reproduce example:
    public void func6(string str, params object[] args) {}
    public void func6(int a, params object[] args) {}

Can not work at 4.5.3f3

Hi, I tried slua, but it seems doesn't work at Unity 4.5.3f3, because this version lack UnityEngine.UI, how can I get it work?

Slua.Class not work correctly.

Take a example, a snap of code in main.txt:

-- test inherite class
local mv = My2(1, 2, 3)
local mv_2 = My2(4, 5, 6)      -- I add for test.
mv:Normalize()
mv_2:Normalize()       -- I add for test.
print("mv norm:", mv.x, mv.y, mv.z)      -- I modified for test.
print("mv_2 norm:", mv_2.x, mv_2.y, mv_2.z)      -- I add for test.
mv:Set(10, 20, 30)      -- I modified for test.
mv_2:Set(40, 50, 60)      -- I add for test.
print("mv:", mv.x, mv.y, mv.z)      -- I add for test.
print("mv_2:", mv_2.x, mv_2.y, mv_2.z)      -- I add for test.

will output:

mv norm:    0.62469504755442    0.78086880944303    0.93704257133164
mv_2 norm:    0.62469504755442    0.78086880944303    0.93704257133164
mv:    40    50    60
mv_2:    40    50    60

You will find the value of vector is always replaced by the last instance of the class.
That's because the code classfunc in Helper.cs:

local getmetatable=getmetatable
local function Class(base,static,instance)

    local mt = getmetatable(base)

    local class=static or {}
    setmetatable(class, 
        {
            __call=function(...)
                local r = mt.__call(...)
                local ret = instance or {}
                ret.__base=r

                local ret = setmetatable(ret,{
                    __index=function(t,k)
                        return r[k]
                    end,

                    __newindex=function(t,k,v)
                        r[k]=v
                    end,
                })

                return ret
            end,
        }
    )
    return class
end
return Class

Once you used NewCls = Slua.Class(BaseCls, xxx, xxx), the ret is created and will not change any more, but when creating a new instance, the metatable of ret is set to the last instance of NewCls, and then being returned, but in this case, ret should never be modified anyway. So that's why it always output value of the last instance.

unity crash

Receiving unhandled NULL exception
Launching bug reporter
Obtained 63 stack frames.
#0  0x00000004887bb6 in mono_arch_find_jit_info_ext
#1  0x0000000484dddb in mono_find_jit_info
#2  0x0000000484dc7c in mono_find_jit_info
#3  0x0000000484e7dc in mono_jit_walk_stack_from_ctx
#4  0x0000000484e904 in mono_jit_walk_stack
#5  0x000000048d338d in mono_method_get_last_managed
#6  0x000000009609e2 in ExtractMonoStacktrace(std::string const&, std::string&, std::string&, int, std::string&, int*, int, int)
#7  0x00000000abd556 in DebugStringToFile(char const*, int, char const*, int, int, int, int)
#8  0x00000000f4a0d0 in Debug_CUSTOM_Internal_Log(int, ICallString, ScriptingObjectOfType<Object>)
#9  0x0000002fcf4720 in  (wrapper managed-to-native) UnityEngine.Debug:Internal_Log (int,string,UnityEngine.Object) + 0x50 (0x2fcf46d0 0x2fcf4773) [0x8e87a80 - Unity Child Domain]
#10 0x0000002fe13579 in  UnityEngine.Debug:LogError (object) + 0x71 (0x2fe13508 0x2fe13590) [0x8e87a80 - Unity Child Domain]
#11 0x0000004271bd1e in  SLua.LuaState:errorReport (intptr) + 0x10e (0x4271bc10 0x4271bd58) [0x8e87a80 - Unity Child Domain]
#12 0x0000001a29dea1 in  (wrapper native-to-managed) SLua.LuaState:errorReport (intptr) + 0x91 (0x1a29de10 0x1a29ded0) [0x8e87a80 - Unity Child Domain]
#13 0x00000027f5258d in luaD_precall
#14 0x00000027f529d7 in luaD_call
#15 0x00000027f57ad5 in luaG_errormsg
#16 0x00000027f4d2e5 in lua_error
#17 0x00000027f53436 in luaB_auxwrap
#18 0x00000027f5258d in luaD_precall
#19 0x00000027f529d7 in luaD_call
#20 0x00000027f4d081 in f_call
#21 0x00000027f52123 in luaD_rawrunprotected
#22 0x00000027f52c40 in luaD_pcall
#23 0x00000027f4d045 in lua_pcall
#24 0x0000001a29e1c8 in  (wrapper managed-to-native) LuaInterface.LuaDLL:lua_pcall (intptr,int,int,int) + 0x80 (0x1a29e148 0x1a29e22d) [0x8e87a80 - Unity Child Domain]
#25 0x0000002fe02d7b in  SLua.LuaFunction:call (int,int) + 0x193 (0x2fe02be8 0x2fe02dd8) [0x8e87a80 - Unity Child Domain]
#26 0x00000034589638 in  SLua.LuaTimer/<Add>c__AnonStorey4B:<>m__4E (int) + 0x80 (0x345895b8 0x34589672) [0x8e87a80 - Unity Child Domain]
#27 0x0000003458959c in  SLua.LuaTimer/<add>c__AnonStorey4A:<>m__4D (int) + 0x2c (0x34589570 0x345895b5) [0x8e87a80 - Unity Child Domain]
#28 0x0000002fe1fd15 in  SLua.LuaTimer:tick (single) + 0x5c5 (0x2fe1f750 0x2fe1fdec) [0x8e87a80 - Unity Child Domain]
#29 0x0000002fe1ebd5 in  SLua.LuaSvr:tick () + 0x115 (0x2fe1eac0 0x2fe1ebec) [0x8e87a80 - Unity Child Domain]
#30 0x0000002fe1e99e in  SLua.LuaSvrGameObject:Update () + 0x3e (0x2fe1e960 0x2fe1e9b5) [0x8e87a80 - Unity Child Domain]
#31 0x00000015e23b4f in  (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) + 0x8f (0x15e23ac0 0x15e23c1a) [0x8e87a80 - Unity Child Domain]
#32 0x000000047d5a16 in mono_get_runtime_build_info
#33 0x000000049094b7 in mono_runtime_invoke
#34 0x00000000730b0c in scripting_method_invoke(ScriptingMethodMono, MonoObject*, ScriptingArguments&, MonoException**)
#35 0x0000000097aec1 in ScriptingInvocationNoArgs::Invoke(MonoException**)
#36 0x0000000097ae1e in ScriptingInvocationNoArgs::Invoke()
#37 0x0000000095f5fa in MonoBehaviour::CallMethodIfAvailable(int)
#38 0x00000000959e7a in MonoBehaviour::CallUpdateMethod(int)
#39 0x00000000959ea9 in MonoBehaviour::Update()
#40 0x000000006fdfd0 in void BaseBehaviourManager::CommonUpdate<BehaviourManager>()
#41 0x00000000871367 in PlayerLoop(bool, bool, IHookEvent*)
#42 0x000000014d4c19 in Application::UpdateScene(bool)
#43 0x000000014d11c9 in Application::UpdateSceneIfNeeded()
#44 0x000000014d0209 in Application::TickTimer()
#45 0x000000016c2168 in -[EditorApplication TickTimer]
#46 0x00000091f4a6cf in __NSFireTimer
#47 0x00000094246006 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
#48 0x00000094245ab4 in __CFRunLoopDoTimer
#49 0x000000942c154f in __CFRunLoopDoTimers
#50 0x000000941fd531 in __CFRunLoopRun
#51 0x000000941fcaa6 in CFRunLoopRunSpecific
#52 0x000000941fc90b in CFRunLoopRunInMode
#53 0x000000936808f8 in RunCurrentEventLoopInMode
#54 0x00000093680631 in ReceiveNextEventCommon
#55 0x0000009368042c in _BlockUntilNextEventMatchingListInModeWithFilter
#56 0x000000968d8b41 in _DPSNextEvent
#57 0x000000968d81e5 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#58 0x000000968ccb9c in -[NSApplication run]
#59 0x00000096841fa0 in NSApplicationMain
#60 0x000000016d78bb in EditorMain(int, char const**)
#61 0x000000016d7ff8 in main
#62 0x00000000003435 in start

*** Launching bug reporter due to crashbug.
Obtained 69 stack frames.
0   Unity                               0x016ba271 _Z17LaunchBugReporter13BugReportMode + 1073
1   Unity                               0x009654a5 _Z12HandleSignaliP9__siginfoPv + 53
2   libmono.0.dylib                     0x0488981a mono_chain_signal + 76
3   libmono.0.dylib                     0x047d3ae2 mono_sigsegv_signal_handler + 234
4   libsystem_platform.dylib            0x93bac03b _sigtramp + 43
5   ???                                 0xffffffff 0x0 + 4294967295
6   libmono.0.dylib                     0x0484dddb mono_find_jit_info + 471
7   libmono.0.dylib                     0x0484dc7c mono_find_jit_info + 120
8   libmono.0.dylib                     0x0484e7dc mono_jit_walk_stack_from_ctx + 292
9   libmono.0.dylib                     0x0484e904 mono_jit_walk_stack + 45
10  libmono.0.dylib                     0x048d338d mono_method_get_last_managed + 57
11  Unity                               0x009609e2 _ZL21ExtractMonoStacktraceRKSsRSsS1_iS1_Piii + 50
12  Unity                               0x00abd556 _Z17DebugStringToFilePKciS0_iiii + 198
13  Unity                               0x00f4a0d0 _Z25Debug_CUSTOM_Internal_Logi11ICallString21ScriptingObjectOfTypeI6ObjectE + 128
14  ???                                 0x2fcf4720 0x0 + 802113312
15  ???                                 0x2fe13579 0x0 + 803288441
16  ???                                 0x4271bd1e 0x0 + 1114750238
17  ???                                 0x1a29dea1 0x0 + 438951585
18  slua                                0x27f5258d luaD_precall + 543
19  slua                                0x27f529d7 luaD_call + 88
20  slua                                0x27f57ad5 luaG_errormsg + 144
21  slua                                0x27f4d2e5 lua_error + 17
22  slua                                0x27f53436 luaB_auxwrap + 131
23  slua                                0x27f5258d luaD_precall + 543
24  slua                                0x27f529d7 luaD_call + 88
25  slua                                0x27f4d081 f_call + 33
26  slua                                0x27f52123 luaD_rawrunprotected + 59
27  slua                                0x27f52c40 luaD_pcall + 66
28  slua                                0x27f4d045 lua_pcall + 99
29  ???                                 0x1a29e1c8 0x0 + 438952392
30  ???                                 0x2fe02d7b 0x0 + 803220859
31  ???                                 0x34589638 0x0 + 878220856
32  ???                                 0x3458959c 0x0 + 878220700
33  ???                                 0x2fe1fd15 0x0 + 803339541
34  ???                                 0x2fe1ebd5 0x0 + 803335125
35  ???                                 0x2fe1e99e 0x0 + 803334558
36  ???                                 0x15e23b4f 0x0 + 367147855
37  libmono.0.dylib                     0x047d5a16 mono_get_runtime_build_info + 3344
38  libmono.0.dylib                     0x049094b7 mono_runtime_invoke + 133
39  Unity                               0x00730b0c _Z23scripting_method_invoke19ScriptingMethodMonoP10MonoObjectR18ScriptingArgumentsPP13MonoException + 60
40  Unity                               0x0097aec1 _ZN25ScriptingInvocationNoArgs6InvokeEPP13MonoException + 145
41  Unity                               0x0097ae1e _ZN25ScriptingInvocationNoArgs6InvokeEv + 30
42  Unity                               0x0095f5fa _ZN13MonoBehaviour21CallMethodIfAvailableEi + 458
43  Unity                               0x00959e7a _ZN13MonoBehaviour16CallUpdateMethodEi + 314
44  Unity                               0x00959ea9 _ZN13MonoBehaviour6UpdateEv + 25
45  Unity                               0x006fdfd0 _ZN20BaseBehaviourManager12CommonUpdateI16BehaviourManagerEEvv + 448
46  Unity                               0x00871367 _Z10PlayerLoopbbP10IHookEvent + 1639
47  Unity                               0x014d4c19 _ZN11Application11UpdateSceneEb + 457
48  Unity                               0x014d11c9 _ZN11Application19UpdateSceneIfNeededEv + 73
49  Unity                               0x014d0209 _ZN11Application9TickTimerEv + 2057
50  Unity                               0x016c2168 -[EditorApplication TickTimer] + 24
51  Foundation                          0x91f4a6cf __NSFireTimer + 119
52  CoreFoundation                      0x94246006 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
53  CoreFoundation                      0x94245ab4 __CFRunLoopDoTimer + 1316
54  CoreFoundation                      0x942c154f __CFRunLoopDoTimers + 351
55  CoreFoundation                      0x941fd531 __CFRunLoopRun + 2081
56  CoreFoundation                      0x941fcaa6 CFRunLoopRunSpecific + 390
57  CoreFoundation                      0x941fc90b CFRunLoopRunInMode + 123
58  HIToolbox                           0x936808f8 RunCurrentEventLoopInMode + 262
59  HIToolbox                           0x93680631 ReceiveNextEventCommon + 494
60  HIToolbox                           0x9368042c _BlockUntilNextEventMatchingListInModeWithFilter + 99
61  AppKit                              0x968d8b41 _DPSNextEvent + 742
62  AppKit                              0x968d81e5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 350
63  AppKit                              0x968ccb9c -[NSApplication run] + 907
64  AppKit                              0x96841fa0 NSApplicationMain + 2082
65  Unity                               0x016d78bb _Z10EditorMainiPPKc + 1339
66  Unity                               0x016d7ff8 main + 24
67  Unity                               0x00003435 start + 53
68  ???                                 0x00000001 0x0 + 1
Stacktrace:

  at (wrapper managed-to-native) UnityEngine.Debug.Internal_Log (int,string,UnityEngine.Object) <0x00004>
  at (wrapper managed-to-native) UnityEngine.Debug.Internal_Log (int,string,UnityEngine.Object) <0x00004>
  at UnityEngine.Debug.LogError (object) <IL 0x00018, 0x00070>
  at SLua.LuaState.errorReport (intptr) [0x0003d] in /Volumes/User HD/wisetap_dev/client/2015/client/Assets/Slua/Script/LuaState.cs:598
  at (wrapper native-to-managed) SLua.LuaState.errorReport (intptr) <IL 0x00017, 0x00090>

Native stacktrace:

    0   libsystem_kernel.dylib              0x9508c69a __pthread_kill + 10
    1   libsystem_c.dylib                   0x9042deee abort + 156
    2   Unity                               0x016ba2c5 _Z17LaunchBugReporter13BugReportMode + 1157
    3   Unity                               0x009654a5 _Z12HandleSignaliP9__siginfoPv + 53
    4   libmono.0.dylib                     0x0488981a mono_chain_signal + 76
    5   libmono.0.dylib                     0x047d3ae2 mono_sigsegv_signal_handler + 234
    6   libsystem_platform.dylib            0x93bac03b _sigtramp + 43
    7   ???                                 0xffffffff 0x0 + 4294967295
    8   libmono.0.dylib                     0x0484dddb mono_find_jit_info + 471
    9   libmono.0.dylib                     0x0484dc7c mono_find_jit_info + 120
    10  libmono.0.dylib                     0x0484e7dc mono_jit_walk_stack_from_ctx + 292
    11  libmono.0.dylib                     0x0484e904 mono_jit_walk_stack + 45
    12  libmono.0.dylib                     0x048d338d mono_method_get_last_managed + 57
    13  Unity                               0x009609e2 _ZL21ExtractMonoStacktraceRKSsRSsS1_iS1_Piii + 50
    14  Unity                               0x00abd556 _Z17DebugStringToFilePKciS0_iiii + 198
    15  Unity                               0x00f4a0d0 _Z25Debug_CUSTOM_Internal_Logi11ICallString21ScriptingObjectOfTypeI6ObjectE + 128
    16  ???                                 0x2fcf4720 0x0 + 802113312
    17  ???                                 0x2fe13579 0x0 + 803288441
    18  ???                                 0x4271bd1e 0x0 + 1114750238
    19  ???                                 0x1a29dea1 0x0 + 438951585
    20  slua                                0x27f5258d luaD_precall + 543
    21  slua                                0x27f529d7 luaD_call + 88
    22  slua                                0x27f57ad5 luaG_errormsg + 144
    23  slua                                0x27f4d2e5 lua_error + 17
    24  slua                                0x27f53436 luaB_auxwrap + 131
    25  slua                                0x27f5258d luaD_precall + 543
    26  slua                                0x27f529d7 luaD_call + 88
    27  slua                                0x27f4d081 f_call + 33
    28  slua                                0x27f52123 luaD_rawrunprotected + 59
    29  slua                                0x27f52c40 luaD_pcall + 66
    30  slua                                0x27f4d045 lua_pcall + 99
    31  ???                                 0x1a29e1c8 0x0 + 438952392
    32  ???                                 0x2fe02d7b 0x0 + 803220859
    33  ???                                 0x34589638 0x0 + 878220856
    34  ???                                 0x3458959c 0x0 + 878220700
    35  ???                                 0x2fe1fd15 0x0 + 803339541
    36  ???                                 0x2fe1ebd5 0x0 + 803335125
    37  ???                                 0x2fe1e99e 0x0 + 803334558
    38  ???                                 0x15e23b4f 0x0 + 367147855
    39  libmono.0.dylib                     0x047d5a16 mono_get_runtime_build_info + 3344
    40  libmono.0.dylib                     0x049094b7 mono_runtime_invoke + 133
    41  Unity                               0x00730b0c _Z23scripting_method_invoke19ScriptingMethodMonoP10MonoObjectR18ScriptingArgumentsPP13MonoException + 60
    42  Unity                               0x0097aec1 _ZN25ScriptingInvocationNoArgs6InvokeEPP13MonoException + 145
    43  Unity                               0x0097ae1e _ZN25ScriptingInvocationNoArgs6InvokeEv + 30
    44  Unity                               0x0095f5fa _ZN13MonoBehaviour21CallMethodIfAvailableEi + 458
    45  Unity                               0x00959e7a _ZN13MonoBehaviour16CallUpdateMethodEi + 314
    46  Unity                               0x00959ea9 _ZN13MonoBehaviour6UpdateEv + 25
    47  Unity                               0x006fdfd0 _ZN20BaseBehaviourManager12CommonUpdateI16BehaviourManagerEEvv + 448
    48  Unity                               0x00871367 _Z10PlayerLoopbbP10IHookEvent + 1639
    49  Unity                               0x014d4c19 _ZN11Application11UpdateSceneEb + 457
    50  Unity                               0x014d11c9 _ZN11Application19UpdateSceneIfNeededEv + 73
    51  Unity                               0x014d0209 _ZN11Application9TickTimerEv + 2057
    52  Unity                               0x016c2168 -[EditorApplication TickTimer] + 24
    53  Foundation                          0x91f4a6cf __NSFireTimer + 119
    54  CoreFoundation                      0x94246006 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    55  CoreFoundation                      0x94245ab4 __CFRunLoopDoTimer + 1316
    56  CoreFoundation                      0x942c154f __CFRunLoopDoTimers + 351
    57  CoreFoundation                      0x941fd531 __CFRunLoopRun + 2081
    58  CoreFoundation                      0x941fcaa6 CFRunLoopRunSpecific + 390
    59  CoreFoundation                      0x941fc90b CFRunLoopRunInMode + 123
    60  HIToolbox                           0x936808f8 RunCurrentEventLoopInMode + 262
    61  HIToolbox                           0x93680631 ReceiveNextEventCommon + 494
    62  HIToolbox                           0x9368042c _BlockUntilNextEventMatchingListInModeWithFilter + 99
    63  AppKit                              0x968d8b41 _DPSNextEvent + 742
    64  AppKit                              0x968d81e5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 350
    65  AppKit                              0x968ccb9c -[NSApplication run] + 907
    66  AppKit                              0x96841fa0 NSApplicationMain + 2082
    67  Unity                               0x016d78bb _Z10EditorMainiPPKc + 1339
    68  Unity                               0x016d7ff8 main + 24
    69  Unity                               0x00003435 start + 53

Debug info from gdb:


=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Suggestions of DebugInterface

  1. Can DebugInterface's debug addr and port be configurated?
  2. Can DebugInterface be disable and enable at runtime?

A few words about the suggestions, We would like to have DebugInterface be complied with our releasing game (as the last solution to save our ass), but we don't want it be enabled every time, it would be enabled when needed only.
We have developed some games with cocos, we have developed a similar debugger like DebugInterface, here is how we handles:

  1. Read debug addr and debug port from a config at persistentDataPath
  2. If debug addr and port exist then starts the debugger.

Request Filter for LuaCodeGen

Hi there
Can user filter out the unity classes or namespaces are not needed(eg, VR), when generating binding code.

关于第三方dll动态库链接的问题

比如我要编译一个 3rd.dll,它依赖的 libs = [lua51.lib]
其中lua51.lib是luajit项目编译出来的

因为slua在make的时候把lua51.dll改名为了slua.dll放到项目里,但这个改名似乎会导致3rd.dll找不到依赖。
试过几种方案:

  1. 把slua.dll名字改为lua51.dll,并对应修改dllimport的名字,则可以正常工作。
  2. 把lua51.lib重命名成slub.lib,再link出3rd.dll,依然无法工作。
  3. 直接修改msvcbuild.bat里的LJLIBNAME = slua.lib,进行编译,则可正常工作。

不知道关于这个问题,@pangweiwei 你怎么看?

SLua.LuaSvr:tick crash

Some function not remove temp value() from lua stack. You should fix it.
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:LogError(Object)
SLua.LuaSvr:tick() (at Assets/Slua/Script/LuaSvr.cs:101)
SLua.LuaSvrGameObject:Update() (at Assets/Slua/Script/LuaSvrGameObject.cs:48)

(Filename: Assets/Slua/Script/LuaSvr.cs Line: 101)

Receiving unhandled NULL exception
Launching bug reporter
Obtained 39 stack frames.
#0  0x000000973ac920 in strlen
#1  0x000000048ea72e in ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi
#2  0x0000002e556574 in  (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:PtrToStringAnsi (intptr) + 0x3c (0x2e556538 0x2e5565b7) [0xf398a80 - Unity Child Domain]
#3  0x0000002e556445 in  LuaInterface.LuaDLL:lua_typenamestr (intptr,LuaInterface.LuaTypes) + 0x4d (0x2e5563f8 0x2e556450) [0xf398a80 - Unity Child Domain]
#4  0x0000002e5563dd in  LuaInterface.LuaDLL:luaL_typename (intptr,int) + 0x3d (0x2e5563a0 0x2e5563e8) [0xf398a80 - Unity Child Domain]
#5  0x00000038be38c5 in  SLua.LuaSvr:tick () + 0xb5 (0x38be3810 0x38be393c) [0xf398a80 - Unity Child Domain]
#6  0x00000038be37f6 in  SLua.LuaSvrGameObject:Update () + 0x3e (0x38be37b8 0x38be380d) [0xf398a80 - Unity Child Domain]
#7  0x00000017b72b4f in  (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) + 0x8f (0x17b72ac0 0x17b72c1a) [0xf398a80 - Unity Child Domain]
#8  0x000000047d5a16 in mono_get_runtime_build_info
#9  0x000000049094b7 in mono_runtime_invoke
#10 0x00000000730b0c in scripting_method_invoke(ScriptingMethodMono, MonoObject*, ScriptingArguments&, MonoException**)
#11 0x0000000097aec1 in ScriptingInvocationNoArgs::Invoke(MonoException**)
#12 0x0000000097ae1e in ScriptingInvocationNoArgs::Invoke()
#13 0x0000000095f5fa in MonoBehaviour::CallMethodIfAvailable(int)
#14 0x00000000959e7a in MonoBehaviour::CallUpdateMethod(int)
#15 0x00000000959ea9 in MonoBehaviour::Update()
#16 0x000000006fdfd0 in void BaseBehaviourManager::CommonUpdate<BehaviourManager>()
#17 0x00000000871367 in PlayerLoop(bool, bool, IHookEvent*)
#18 0x000000014d4c19 in Application::UpdateScene(bool)
#19 0x000000014d11c9 in Application::UpdateSceneIfNeeded()
#20 0x000000014d0209 in Application::TickTimer()
#21 0x000000016c2168 in -[EditorApplication TickTimer]
#22 0x00000099e2c6cf in __NSFireTimer
#23 0x0000009b6ac006 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
#24 0x0000009b6abab4 in __CFRunLoopDoTimer
#25 0x0000009b72754f in __CFRunLoopDoTimers
#26 0x0000009b663531 in __CFRunLoopRun
#27 0x0000009b662aa6 in CFRunLoopRunSpecific
#28 0x0000009b66290b in CFRunLoopRunInMode
#29 0x0000009746f8f8 in RunCurrentEventLoopInMode
#30 0x0000009746f631 in ReceiveNextEventCommon
#31 0x0000009746f42c in _BlockUntilNextEventMatchingListInModeWithFilter
#32 0x00000090bd8721 in _DPSNextEvent
#33 0x00000090bd7dc5 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#34 0x00000090bcc77c in -[NSApplication run]
#35 0x00000090b41bc0 in NSApplicationMain
#36 0x000000016d78bb in EditorMain(int, char const**)
#37 0x000000016d7ff8 in main
#38 0x00000000003435 in start

*** Launching bug reporter due to crashbug.
Obtained 44 stack frames.
0   Unity                               0x016ba271 _Z17LaunchBugReporter13BugReportMode + 1073
1   Unity                               0x009654a5 _Z12HandleSignaliP9__siginfoPv + 53
2   libmono.0.dylib                     0x0488981a mono_chain_signal + 76
3   libmono.0.dylib                     0x047d3ae2 mono_sigsegv_signal_handler + 234
4   libsystem_platform.dylib            0x900e503b _sigtramp + 43
5   ???                                 0xffffffff 0x0 + 4294967295
6   libmono.0.dylib                     0x048ea72e ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi + 37
7   ???                                 0x2e556574 0x0 + 777348468
8   ???                                 0x2e556445 0x0 + 777348165
9   ???                                 0x2e5563dd 0x0 + 777348061
10  ???                                 0x38be38c5 0x0 + 951990469
11  ???                                 0x38be37f6 0x0 + 951990262
12  ???                                 0x17b72b4f 0x0 + 397880143
13  libmono.0.dylib                     0x047d5a16 mono_get_runtime_build_info + 3344
14  libmono.0.dylib                     0x049094b7 mono_runtime_invoke + 133
15  Unity                               0x00730b0c _Z23scripting_method_invoke19ScriptingMethodMonoP10MonoObjectR18ScriptingArgumentsPP13MonoException + 60
16  Unity                               0x0097aec1 _ZN25ScriptingInvocationNoArgs6InvokeEPP13MonoException + 145
17  Unity                               0x0097ae1e _ZN25ScriptingInvocationNoArgs6InvokeEv + 30
18  Unity                               0x0095f5fa _ZN13MonoBehaviour21CallMethodIfAvailableEi + 458
19  Unity                               0x00959e7a _ZN13MonoBehaviour16CallUpdateMethodEi + 314
20  Unity                               0x00959ea9 _ZN13MonoBehaviour6UpdateEv + 25
21  Unity                               0x006fdfd0 _ZN20BaseBehaviourManager12CommonUpdateI16BehaviourManagerEEvv + 448
22  Unity                               0x00871367 _Z10PlayerLoopbbP10IHookEvent + 1639
23  Unity                               0x014d4c19 _ZN11Application11UpdateSceneEb + 457
24  Unity                               0x014d11c9 _ZN11Application19UpdateSceneIfNeededEv + 73
25  Unity                               0x014d0209 _ZN11Application9TickTimerEv + 2057
26  Unity                               0x016c2168 -[EditorApplication TickTimer] + 24
27  Foundation                          0x99e2c6cf __NSFireTimer + 119
28  CoreFoundation                      0x9b6ac006 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
29  CoreFoundation                      0x9b6abab4 __CFRunLoopDoTimer + 1316
30  CoreFoundation                      0x9b72754f __CFRunLoopDoTimers + 351
31  CoreFoundation                      0x9b663531 __CFRunLoopRun + 2081
32  CoreFoundation                      0x9b662aa6 CFRunLoopRunSpecific + 390
33  CoreFoundation                      0x9b66290b CFRunLoopRunInMode + 123
34  HIToolbox                           0x9746f8f8 RunCurrentEventLoopInMode + 262
35  HIToolbox                           0x9746f631 ReceiveNextEventCommon + 494
36  HIToolbox                           0x9746f42c _BlockUntilNextEventMatchingListInModeWithFilter + 99
37  AppKit                              0x90bd8721 _DPSNextEvent + 742
38  AppKit                              0x90bd7dc5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 350
39  AppKit                              0x90bcc77c -[NSApplication run] + 907
40  AppKit                              0x90b41bc0 NSApplicationMain + 2082
41  Unity                               0x016d78bb _Z10EditorMainiPPKc + 1339
42  Unity                               0x016d7ff8 main + 24
43  Unity                               0x00003435 start + 53
Material 0: Orc
Texture 0: Map #0
Material 0: Orc
Texture 0: Map #0
Material 0: Armor - Orc
Texture 0: Map #1
Material 0: Orc
Texture 0: Map #0
Material 0: Material #1
Material 1: Material #0
Texture 0: Map #3
Texture 1: Map #2
Material 0: Armor - Orc
Texture 0: Map #1
Material 0: Material #1
Material 1: Material #0
Texture 0: Map #3
Texture 1: Map #2
Stacktrace:

  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.PtrToStringAnsi (intptr) <0x00004>
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal.PtrToStringAnsi (intptr) <0x00004>
  at LuaInterface.LuaDLL.lua_typenamestr (intptr,LuaInterface.LuaTypes) [0x00008] in /Volumes/client/Assets/Slua/Script/LuaDLL.cs:118
  at LuaInterface.LuaDLL.luaL_typename (intptr,int) [0x00000] in /Volumes/client/Assets/Slua/Script/LuaDLL.cs:122
  at SLua.LuaSvr.tick () [0x00031] in /Volumes/client/Assets/Slua/Script/LuaSvr.cs:101
  at SLua.LuaSvrGameObject.Update () [0x0000b] in /Volumes/client/Assets/Slua/Script/LuaSvrGameObject.cs:48
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x0001c, 0x0008e>

Native stacktrace:

    0   libsystem_kernel.dylib              0x95ed269a __pthread_kill + 10
    1   libsystem_c.dylib                   0x97409eee abort + 156
    2   Unity                               0x016ba2c5 _Z17LaunchBugReporter13BugReportMode + 1157
    3   Unity                               0x009654a5 _Z12HandleSignaliP9__siginfoPv + 53
    4   libmono.0.dylib                     0x0488981a mono_chain_signal + 76
    5   libmono.0.dylib                     0x047d3ae2 mono_sigsegv_signal_handler + 234
    6   libsystem_platform.dylib            0x900e503b _sigtramp + 43
    7   ???                                 0xffffffff 0x0 + 4294967295
    8   libmono.0.dylib                     0x048ea72e ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi + 37
    9   ???                                 0x2e556574 0x0 + 777348468
    10  ???                                 0x2e556445 0x0 + 777348165
    11  ???                                 0x2e5563dd 0x0 + 777348061
    12  ???                                 0x38be38c5 0x0 + 951990469
    13  ???                                 0x38be37f6 0x0 + 951990262
    14  ???                                 0x17b72b4f 0x0 + 397880143
    15  libmono.0.dylib                     0x047d5a16 mono_get_runtime_build_info + 3344
    16  libmono.0.dylib                     0x049094b7 mono_runtime_invoke + 133
    17  Unity                               0x00730b0c _Z23scripting_method_invoke19ScriptingMethodMonoP10MonoObjectR18ScriptingArgumentsPP13MonoException + 60
    18  Unity                               0x0097aec1 _ZN25ScriptingInvocationNoArgs6InvokeEPP13MonoException + 145
    19  Unity                               0x0097ae1e _ZN25ScriptingInvocationNoArgs6InvokeEv + 30
    20  Unity                               0x0095f5fa _ZN13MonoBehaviour21CallMethodIfAvailableEi + 458
    21  Unity                               0x00959e7a _ZN13MonoBehaviour16CallUpdateMethodEi + 314
    22  Unity                               0x00959ea9 _ZN13MonoBehaviour6UpdateEv + 25
    23  Unity                               0x006fdfd0 _ZN20BaseBehaviourManager12CommonUpdateI16BehaviourManagerEEvv + 448
    24  Unity                               0x00871367 _Z10PlayerLoopbbP10IHookEvent + 1639
    25  Unity                               0x014d4c19 _ZN11Application11UpdateSceneEb + 457
    26  Unity                               0x014d11c9 _ZN11Application19UpdateSceneIfNeededEv + 73
    27  Unity                               0x014d0209 _ZN11Application9TickTimerEv + 2057
    28  Unity                               0x016c2168 -[EditorApplication TickTimer] + 24
    29  Foundation                          0x99e2c6cf __NSFireTimer + 119
    30  CoreFoundation                      0x9b6ac006 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    31  CoreFoundation                      0x9b6abab4 __CFRunLoopDoTimer + 1316
    32  CoreFoundation                      0x9b72754f __CFRunLoopDoTimers + 351
    33  CoreFoundation                      0x9b663531 __CFRunLoopRun + 2081
    34  CoreFoundation                      0x9b662aa6 CFRunLoopRunSpecific + 390
    35  CoreFoundation                      0x9b66290b CFRunLoopRunInMode + 123
    36  HIToolbox                           0x9746f8f8 RunCurrentEventLoopInMode + 262
    37  HIToolbox                           0x9746f631 ReceiveNextEventCommon + 494
    38  HIToolbox                           0x9746f42c _BlockUntilNextEventMatchingListInModeWithFilter + 99
    39  AppKit                              0x90bd8721 _DPSNextEvent + 742
    40  AppKit                              0x90bd7dc5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 350
    41  AppKit                              0x90bcc77c -[NSApplication run] + 907
    42  AppKit                              0x90b41bc0 NSApplicationMain + 2082
    43  Unity                               0x016d78bb _Z10EditorMainiPPKc + 1339
    44  Unity                               0x016d7ff8 main + 24
    45  Unity                               0x00003435 start + 53

Debug info from gdb:


=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Unity(54305,0xa0cba1d4) malloc: *** error for object 0x2a2e3000: Can't deallocate_pages region
Unity(54305,0xa0cba1d4) malloc: *** set a breakpoint in malloc_error_break to debug

SLuaSetting.cs cannot be complied for player

SLuaSetting.cs cannot be complied for player since it using UnityEditor features.

using UnityEditor;
#if UNITY_5
                    _instance = AssetDatabase.LoadAssetAtPath<SLuaSetting>(path);
#else
                    _instance = (SLuaSetting)AssetDatabase.LoadAssetAtPath(path,typeof(SLuaSetting));
#endif
                    if(_instance == null){
                        _instance =  SLuaSetting.CreateInstance<SLuaSetting>();
                        AssetDatabase.CreateAsset(_instance,path);
                    }
        [MenuItem("SLua/Setting")]
        public static void Open(){
            Selection.activeObject = Instance;
        }

C# Events and Delegates

Thank you for your response to my other posts.

I was wondering if SLua supported subscribing to C# events? I can see why this might be difficult/impossible, but wanted to see if you had any solution?

I knwo you mentioned to use delegates directly, but I'm not sure if you mean your Lua delegates or C# delegates? If c# do you mean anonymous delegate? How do I access the += and -= operators to register/deregister my Lua listener? A simple example would be awesome.

Thanks!

Lua3rdDLL.open(L) takes about 1.3 sec but doing nothing

I notice in file LuaSvr.cs function doinit(), calls to Lua3rdDLL.open(L) take about 1.3 sec but doing nothing and GC alloc goes up to 37mb
Seems the code as follows cause the problem.

var csfunctions = assembly.GetExportedTypes()
                    .SelectMany(x => x.GetMethods())
                        .Where(y => y.GetCustomAttributes(typeof(LualibRegAttribute),false).Any())
                        .ToList();

Any Idea ? Thanks !

Unity打包版本Mono内存泄漏问题(无论是windows版本还是设备版本)

现象:在Editor中运行正常,ObjectCache中的垃圾都会被回收掉,但是打包后运行版本ObjectCache中的已经被Destroy的UnityEngine.Object不会被垃圾回收,导致Mono用到的内存会越来越高。
截图1:
image
多次点击GC后,截图2:
image
可以看到,正常的object已经被gc,但是为null的UnityObject未被释放。

原因:Unity Editor中跟正常运行的打包版本,UnityEngine.Object处理不同,在UnityEditor中,当一个UnityObject被释放后,调用 GetHashCode()方法还是可以取到正确的值(释放的不是很彻底),但是打包版本调用此方法时,返回的是0

解决方法:ObjectCache修改objMap的Dictionary比较器

        public class ObjEqualityComparer : IEqualityComparer<object>
        {
            public bool Equals(object x, object y)
            {

                return ReferenceEquals(x, y);
            }

            public int GetHashCode(object obj)
            {
                return RuntimeHelpers.GetHashCode(obj);
            }
        }

        Dictionary<object, int> objMap = new Dictionary<object, int>(new ObjEqualityComparer());

这个bug我们找了整整2天,测试代码无法上传,自己修改Dictionary<object, int> objMap为public,写个监控即可。

iOS 3rd dll 打开时加载 lua3rdmeta 报错

A script behaviour (script unknown or not yet loaded) has a different serialization layout when loading. (Read 44 bytes but expected 48 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
UnityEngine.Resources:Load(String)
SLua.Lua3rdMeta:get_Instance()
SLua.Lua3rdDLL:open(IntPtr)
SLua.LuaSvr:doinit(IntPtr, LuaSvrFlag)
SLua.<init>c__AnonStorey1C:<>m__15()
SLua.<waitForBind>c__Iterator1B:MoveNext()

用的 IL2CPP

Error in Unity 5.2.1 when try to export to android/ios

This error is different from last thread. It also occur on normal Unity 5.2.1f1 with no patch release. In Unity 5.2.1, it can play the example directly in Unity Editor but error when tried to export to mobile.

Assets/Slua/LuaObject/Unity/Lua_UnityEditor_Advertisements_AdvertisementSettings.cs(12,33): error CS0103: The name `UnityEditor' does not exist in the current context

Assets/Slua/LuaObject/Unity/Lua_UnityEditor_Advertisements_AdvertisementSettings.cs(146,52): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?

Assets/Slua/LuaObject/Unity/Lua_UnityEditor_Advertisements_AdvertisementSettings.cs(146,17): error CS1502: The best overloaded method match for `SLua.LuaObject.createTypeMetatable(System.IntPtr, LuaInterface.LuaCSFunction, System.Type)' has some invalid arguments

Assets/Slua/LuaObject/Unity/Lua_UnityEditor_Advertisements_AdvertisementSettings.cs(146,17): error CS1503: Argument #3' cannot convertobject' expression to type `System.Type'

Error building Player because scripts had compiler errors

Lua errors list in C#

These function call may lead unity crash:

  • public static extern int luaL_checkinteger(IntPtr luaState, int stackPos);
  • public static extern double luaL_checknumber(IntPtr luaState, int stackPos);
  • public static extern int luaS_rawnetobj(IntPtr luaState, int obj);
  • public static extern void luaS_checkVector2(IntPtr l, int p, out float x, out float y);
  • public static extern void luaS_checkVector3(IntPtr l, int p, out float x, out float y, out float z);
  • public static extern void luaS_checkVector4(IntPtr l, int p, out float x, out float y, out float z, out float w);
  • public static extern void luaS_checkQuaternion(IntPtr l, int p, out float x, out float y, out float z, out float w);
  • public static extern void luaS_checkColor(IntPtr l, int p, out float x, out float y, out float z, out float w);

LuaSvr.init线程池与Resources.LoadSync冲突问题

Unity 4.6.4

如果在LuaSvr.init之前,使用了Resources.LoadAsync函数,会导致init里的线程池执行到一半没有继续,然后导致Editor卡住,内存不停的增加,最后崩溃。

Resources.LoadAsync(uixxxxx)

后面再进行

LuaSvr.init(null, ()=>{
     onFinishInit();
});

经排查,发现线程池执行的函数doBind执行到一定情况,然后就没执行到最后100%

可能两个情况:

  • doBind中某函数大量alloc,导致Editor崩溃(从任务管理器中可知内存在不停递增)
  • 线程池执行的doBind被停掉了

LuaSvr cannot add custom native lib registration before call it's `main` function

I compile a custom native lua lib A into slua plugin.
When I use LuaSvr("xxx"), it call the file's "main" function to start, but inside the function there's code depends on the lib A. I need to register the A lib after luastate created and before the main function execution. But there's no way to achieve this with LuaSvr right now. I think it could provide an option whether to call the main function in the LuaSrv contructor.

Also I could workaround by manually create LuaState and do the bind stuff LuaSrv does to insert my custom register code, or leave 'main' function empty and call another real main later. But I don't think it's a good design.

Please take a consider about that.

VoidDelegate crash

Receiving unhandled NULL exception
Launching bug reporter
Obtained 56 stack frames.
#0  0x0000001c39b9df in lua_pushlstring
#1  0x0000001c39ba45 in lua_pushstring
#2  0x00000019d40e47 in  (wrapper managed-to-native) LuaInterface.LuaDLL:lua_pushstring (intptr,string) + 0x87 (0x19d40dc0 0x19d40eb5) [0x8f44c40 - Unity Child Domain]
#3  0x00000019d424d0 in  LuaInterface.LuaDLL:lua_getglobal (intptr,string) + 0x28 (0x19d424a8 0x19d4250a) [0x8f44c40 - Unity Child Domain]
#4  0x000000276373dc in  SLua.LuaState:get (intptr) + 0xf4 (0x276372e8 0x276374db) [0x8f44c40 - Unity Child Domain]
#5  0x0000002a36b9a9 in  SLua.LuaDelegation/<checkDelegate>c__AnonStorey1D:<>m__2A (UnityEngine.GameObject) + 0x31 (0x2a36b978 0x2a36baa8) [0x8f44c40 - Unity Child Domain]
#6  0x0000002a36b95e in  UIEventListener:OnDragOut () + 0x56 (0x2a36b908 0x2a36b975) [0x8f44c40 - Unity Child Domain]
#7  0x00000015af9b4f in  (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) + 0x8f (0x15af9ac0 0x15af9c1a) [0x8f44c40 - Unity Child Domain]
#8  0x000000047d5a16 in mono_get_runtime_build_info
#9  0x000000049094b7 in mono_runtime_invoke
#10 0x00000000730b0c in scripting_method_invoke(ScriptingMethodMono, MonoObject*, ScriptingArguments&, MonoException**)
#11 0x0000000097a1b9 in ScriptingInvocation::Invoke(MonoException**, bool)
#12 0x0000000097a140 in ScriptingInvocation::Invoke(MonoException**)
#13 0x0000000095acb0 in MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodMono, MonoObject*, MonoException**)
#14 0x0000000095b6ed in MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodMono, MonoObject*)
#15 0x00000000989974 in Scripting::SendScriptingMessage(Unity::GameObject&, char const*, MonoObject*)
#16 0x00000000989e74 in Scripting::SendScriptingMessage(Unity::GameObject&, std::string const&, MonoObject*, int)
#17 0x00000000f55152 in GameObject_CUSTOM_SendMessage(ReadOnlyScriptingObjectOfType<Unity::GameObject>, ICallString, MonoObject*, int)
#18 0x00000027667eb8 in  (wrapper managed-to-native) UnityEngine.GameObject:SendMessage (string,object,UnityEngine.SendMessageOptions) + 0x90 (0x27667e28 0x27667f0b) [0x8f44c40 - Unity Child Domain]
#19 0x00000027667d73 in  UICamera:Notify (UnityEngine.GameObject,string,object) + 0x9b (0x27667cd8 0x27667e22) [0x8f44c40 - Unity Child Domain]
#20 0x000000276675a2 in  UICamera:ProcessTouch (bool,bool) + 0xfc2 (0x276665e0 0x27667cd7) [0x8f44c40 - Unity Child Domain]
#21 0x000000276635ed in  UICamera:ProcessMouse () + 0xc85 (0x27662968 0x2766394f) [0x8f44c40 - Unity Child Domain]
#22 0x00000027646472 in  UICamera:ProcessTouches () + 0x79a (0x27645cd8 0x276464d9) [0x8f44c40 - Unity Child Domain]
#23 0x0000002764578b in  UICamera:Update () + 0x9b (0x276456f0 0x27645c8f) [0x8f44c40 - Unity Child Domain]
#24 0x00000015af9b4f in  (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) + 0x8f (0x15af9ac0 0x15af9c1a) [0x8f44c40 - Unity Child Domain]
#25 0x000000047d5a16 in mono_get_runtime_build_info
#26 0x000000049094b7 in mono_runtime_invoke
#27 0x00000000730b0c in scripting_method_invoke(ScriptingMethodMono, MonoObject*, ScriptingArguments&, MonoException**)
#28 0x0000000097aec1 in ScriptingInvocationNoArgs::Invoke(MonoException**)
#29 0x0000000097ae1e in ScriptingInvocationNoArgs::Invoke()
#30 0x0000000095f5fa in MonoBehaviour::CallMethodIfAvailable(int)
#31 0x00000000959e7a in MonoBehaviour::CallUpdateMethod(int)
#32 0x00000000959ea9 in MonoBehaviour::Update()
#33 0x000000006fdfd0 in void BaseBehaviourManager::CommonUpdate<BehaviourManager>()
#34 0x00000000871367 in PlayerLoop(bool, bool, IHookEvent*)
#35 0x000000014d4c19 in Application::UpdateScene(bool)
#36 0x000000014d11c9 in Application::UpdateSceneIfNeeded()
#37 0x000000014d0209 in Application::TickTimer()
#38 0x000000016c2168 in -[EditorApplication TickTimer]
#39 0x00000099e2c6cf in __NSFireTimer
#40 0x0000009b6ac006 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
#41 0x0000009b6abab4 in __CFRunLoopDoTimer
#42 0x0000009b72754f in __CFRunLoopDoTimers
#43 0x0000009b663531 in __CFRunLoopRun
#44 0x0000009b662aa6 in CFRunLoopRunSpecific
#45 0x0000009b66290b in CFRunLoopRunInMode
#46 0x0000009746f8f8 in RunCurrentEventLoopInMode
#47 0x0000009746f503 in ReceiveNextEventCommon
#48 0x0000009746f42c in _BlockUntilNextEventMatchingListInModeWithFilter
#49 0x00000090bd8721 in _DPSNextEvent
#50 0x00000090bd7dc5 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
#51 0x00000090bcc77c in -[NSApplication run]
#52 0x00000090b41bc0 in NSApplicationMain
#53 0x000000016d78bb in EditorMain(int, char const**)
#54 0x000000016d7ff8 in main
#55 0x00000000003435 in start

*** Launching bug reporter due to crashbug.
Obtained 62 stack frames.
0   Unity                               0x016ba271 _Z17LaunchBugReporter13BugReportMode + 1073
1   Unity                               0x009654a5 _Z12HandleSignaliP9__siginfoPv + 53
2   libmono.0.dylib                     0x0488981a mono_chain_signal + 76
3   libmono.0.dylib                     0x047d3ae2 mono_sigsegv_signal_handler + 234
4   libsystem_platform.dylib            0x900e503b _sigtramp + 43
5   ???                                 0xffffffff 0x0 + 4294967295
6   slua                                0x1c39ba45 lua_pushstring + 42
7   ???                                 0x19d40e47 0x0 + 433327687
8   ???                                 0x19d424d0 0x0 + 433333456
9   ???                                 0x276373dc 0x0 + 660829148
10  ???                                 0x2a36b9a9 0x0 + 708229545
11  ???                                 0x2a36b95e 0x0 + 708229470
12  ???                                 0x15af9b4f 0x0 + 363830095
13  libmono.0.dylib                     0x047d5a16 mono_get_runtime_build_info + 3344
14  libmono.0.dylib                     0x049094b7 mono_runtime_invoke + 133
15  Unity                               0x00730b0c _Z23scripting_method_invoke19ScriptingMethodMonoP10MonoObjectR18ScriptingArgumentsPP13MonoException + 60
16  Unity                               0x0097a1b9 _ZN19ScriptingInvocation6InvokeEPP13MonoExceptionb + 105
17  Unity                               0x0097a140 _ZN19ScriptingInvocation6InvokeEPP13MonoException + 32
18  Unity                               0x0095acb0 _ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE19ScriptingMethodMonoP10MonoObjectPP13MonoException + 352
19  Unity                               0x0095b6ed _ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE19ScriptingMethodMonoP10MonoObject + 221
20  Unity                               0x00989974 _ZN9Scripting20SendScriptingMessageERN5Unity10GameObjectEPKcP10MonoObject + 404
21  Unity                               0x00989e74 _ZN9Scripting20SendScriptingMessageERN5Unity10GameObjectERKSsP10MonoObjecti + 36
22  Unity                               0x00f55152 _Z29GameObject_CUSTOM_SendMessage29ReadOnlyScriptingObjectOfTypeIN5Unity10GameObjectEE11ICallStringP10MonoObjecti + 98
23  ???                                 0x27667eb8 0x0 + 661028536
24  ???                                 0x27667d73 0x0 + 661028211
25  ???                                 0x276675a2 0x0 + 661026210
26  ???                                 0x276635ed 0x0 + 661009901
27  ???                                 0x27646472 0x0 + 660890738
28  ???                                 0x2764578b 0x0 + 660887435
29  ???                                 0x15af9b4f 0x0 + 363830095
30  libmono.0.dylib                     0x047d5a16 mono_get_runtime_build_info + 3344
31  libmono.0.dylib                     0x049094b7 mono_runtime_invoke + 133
32  Unity                               0x00730b0c _Z23scripting_method_invoke19ScriptingMethodMonoP10MonoObjectR18ScriptingArgumentsPP13MonoException + 60
33  Unity                               0x0097aec1 _ZN25ScriptingInvocationNoArgs6InvokeEPP13MonoException + 145
34  Unity                               0x0097ae1e _ZN25ScriptingInvocationNoArgs6InvokeEv + 30
35  Unity                               0x0095f5fa _ZN13MonoBehaviour21CallMethodIfAvailableEi + 458
36  Unity                               0x00959e7a _ZN13MonoBehaviour16CallUpdateMethodEi + 314
37  Unity                               0x00959ea9 _ZN13MonoBehaviour6UpdateEv + 25
38  Unity                               0x006fdfd0 _ZN20BaseBehaviourManager12CommonUpdateI16BehaviourManagerEEvv + 448
39  Unity                               0x00871367 _Z10PlayerLoopbbP10IHookEvent + 1639
40  Unity                               0x014d4c19 _ZN11Application11UpdateSceneEb + 457
41  Unity                               0x014d11c9 _ZN11Application19UpdateSceneIfNeedexxx + 73
42  Unity                               0x014d0209 _ZN11Application9TickTimerEv + 2057
43  Unity                               0x016c2168 -[EditorApplication TickTimer] + 24
44  Foundation                          0x99e2c6cf __NSFireTimer + 119
45  CoreFoundation                      0x9b6ac006 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
46  CoreFoundation                      0x9b6abab4 __CFRunLoopDoTimer + 1316
47  CoreFoundation                      0x9b72754f __CFRunLoopDoTimers + 351
48  CoreFoundation                      0x9b663531 __CFRunLoopRun + 2081
49  CoreFoundation                      0x9b662aa6 CFRunLoopRunSpecific + 390
50  CoreFoundation                      0x9b66290b CFRunLoopRunInMode + 123
51  HIToolbox                           0x9746f8f8 RunCurrentEventLoopInMode + 262
52  HIToolbox                           0x9746f503 ReceiveNextEventCommon + 192
53  HIToolbox                           0x9746f42c _BlockUntilNextEventMatchingListInModeWithFilter + 99
54  AppKit                              0x90bd8721 _DPSNextEvent + 742
55  AppKit                              0x90bd7dc5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 350
56  AppKit                              0x90bcc77c -[NSApplication run] + 907
57  AppKit                              0x90b41bc0 NSApplicationMain + 2082
58  Unity                               0x016d78bb _Z10EditorMainiPPKc + 1339
59  Unity                               0x016d7ff8 main + 24
60  Unity                               0x00003435 start + 53
61  ???                                 0x00000001 0x0 + 1
Stacktrace:

  at (wrapper managed-to-native) LuaInterface.LuaDLL.lua_pushstring (intptr,string) <0x00004>
  at (wrapper managed-to-native) LuaInterface.LuaDLL.lua_pushstring (intptr,string) <0x00004>
  at LuaInterface.LuaDLL.lua_getglobal (intptr,string) [0x00000] in /Volumes/client/Assets/Slua/Script/LuaDLL.cs:316
  at SLua.LuaState.get (intptr) [0x00036] in /Volumes/client/Assets/Slua/Script/LuaState.cs:463
  at SLua.LuaDelegation/<checkDelegate>c__AnonStorey1D.<>m__2A (UnityEngine.GameObject) [0x00000] in /Volumes/client/Assets/Slua/LuaObject/Dll/LuaDelegate_UIEventListener_VoidDelegate.cs:34
  at UIEventListener.OnDragOut () [0x0000b] in /Volumes/client/Assets/NGUI/Scripts/Internal/UIEventListener.cs:51
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x0001c, 0x0008e>
  at (wrapper managed-to-native) UnityEngine.GameObject.SendMessage (string,object,UnityEngine.SendMessageOptions) <0x00004>
  at (wrapper managed-to-native) UnityEngine.GameObject.SendMessage (string,object,UnityEngine.SendMessageOptions) <0x00004>
  at UICamera.Notify (UnityEngine.GameObject,string,object) [0x0001c] in /Volumes/client/Assets/NGUI/Scripts/UI/UICamera.cs:1077
  at UICamera.ProcessTouch (bool,bool) [0x0059c] in /Volumes/client/Assets/NGUI/Scripts/UI/UICamera.cs:1806
  at UICamera.ProcessMouse () [0x0038a] in /Volumes/client/Assets/NGUI/Scripts/UI/UICamera.cs:1427
  at UICamera.ProcessTouches () [0x001f8] in /Volumes/client/Assets/NGUI/Scripts/UI/UICamera.cs:1508
  at UICamera.Update () [0x00027] in /Volumes/client/Assets/NGUI/Scripts/UI/UICamera.cs:1233
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x0001c, 0x0008e>

Native stacktrace:

    0   libsystem_kernel.dylib              0x95ed269a __pthread_kill + 10
    1   libsystem_c.dylib                   0x97409eee abort + 156
    2   Unity                               0x016ba2c5 _Z17LaunchBugReporter13BugReportMode + 1157
    3   Unity                               0x009654a5 _Z12HandleSignaliP9__siginfoPv + 53
    4   libmono.0.dylib                     0x0488981a mono_chain_signal + 76
    5   libmono.0.dylib                     0x047d3ae2 mono_sigsegv_signal_handler + 234
    6   libsystem_platform.dylib            0x900e503b _sigtramp + 43
    7   ???                                 0xffffffff 0x0 + 4294967295
    8   slua                                0x1c39ba45 lua_pushstring + 42
    9   ???                                 0x19d40e47 0x0 + 433327687
    10  ???                                 0x19d424d0 0x0 + 433333456
    11  ???                                 0x276373dc 0x0 + 660829148
    12  ???                                 0x2a36b9a9 0x0 + 708229545
    13  ???                                 0x2a36b95e 0x0 + 708229470
    14  ???                                 0x15af9b4f 0x0 + 363830095
    15  libmono.0.dylib                     0x047d5a16 mono_get_runtime_build_info + 3344
    16  libmono.0.dylib                     0x049094b7 mono_runtime_invoke + 133
    17  Unity                               0x00730b0c _Z23scripting_method_invoke19ScriptingMethodMonoP10MonoObjectR18ScriptingArgumentsPP13MonoException + 60
    18  Unity                               0x0097a1b9 _ZN19ScriptingInvocation6InvokeEPP13MonoExceptionb + 105
    19  Unity                               0x0097a140 _ZN19ScriptingInvocation6InvokeEPP13MonoException + 32
    20  Unity                               0x0095acb0 _ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE19ScriptingMethodMonoP10MonoObjectPP13MonoException + 352
    21  Unity                               0x0095b6ed _ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE19ScriptingMethodMonoP10MonoObject + 221
    22  Unity                               0x00989974 _ZN9Scripting20SendScriptingMessageERN5Unity10GameObjectEPKcP10MonoObject + 404
    23  Unity                               0x00989e74 _ZN9Scripting20SendScriptingMessageERN5Unity10GameObjectERKSsP10MonoObjecti + 36
    24  Unity                               0x00f55152 _Z29GameObject_CUSTOM_SendMessage29ReadOnlyScriptingObjectOfTypeIN5Unity10GameObjectEE11ICallStringP10MonoObjecti + 98
    25  ???                                 0x27667eb8 0x0 + 661028536
    26  ???                                 0x27667d73 0x0 + 661028211
    27  ???                                 0x276675a2 0x0 + 661026210
    28  ???                                 0x276635ed 0x0 + 661009901
    29  ???                                 0x27646472 0x0 + 660890738
    30  ???                                 0x2764578b 0x0 + 660887435
    31  ???                                 0x15af9b4f 0x0 + 363830095
    32  libmono.0.dylib                     0x047d5a16 mono_get_runtime_build_info + 3344
    33  libmono.0.dylib                     0x049094b7 mono_runtime_invoke + 133
    34  Unity                               0x00730b0c _Z23scripting_method_invoke19ScriptingMethodMonoP10MonoObjectR18ScriptingArgumentsPP13MonoException + 60
    35  Unity                               0x0097aec1 _ZN25ScriptingInvocationNoArgs6InvokeEPP13MonoException + 145
    36  Unity                               0x0097ae1e _ZN25ScriptingInvocationNoArgs6InvokeEv + 30
    37  Unity                               0x0095f5fa _ZN13MonoBehaviour21CallMethodIfAvailableEi + 458
    38  Unity                               0x00959e7a _ZN13MonoBehaviour16CallUpdateMethodEi + 314
    39  Unity                               0x00959ea9 _ZN13MonoBehaviour6UpdateEv + 25
    40  Unity                               0x006fdfd0 _ZN20BaseBehaviourManager12CommonUpdateI16BehaviourManagerEEvv + 448
    41  Unity                               0x00871367 _Z10PlayerLoopbbP10IHookEvent + 1639
    42  Unity                               0x014d4c19 _ZN11Application11UpdateSceneEb + 457
    43  Unity                               0x014d11c9 _ZN11Application19UpdateSceneIfNeedexxx + 73
    44  Unity                               0x014d0209 _ZN11Application9TickTimerEv + 2057
    45  Unity                               0x016c2168 -[EditorApplication TickTimer] + 24
    46  Foundation                          0x99e2c6cf __NSFireTimer + 119
    47  CoreFoundation                      0x9b6ac006 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
    48  CoreFoundation                      0x9b6abab4 __CFRunLoopDoTimer + 1316
    49  CoreFoundation                      0x9b72754f __CFRunLoopDoTimers + 351
    50  CoreFoundation                      0x9b663531 __CFRunLoopRun + 2081
    51  CoreFoundation                      0x9b662aa6 CFRunLoopRunSpecific + 390
    52  CoreFoundation                      0x9b66290b CFRunLoopRunInMode + 123
    53  HIToolbox                           0x9746f8f8 RunCurrentEventLoopInMode + 262
    54  HIToolbox                           0x9746f503 ReceiveNextEventCommon + 192
    55  HIToolbox                           0x9746f42c _BlockUntilNextEventMatchingListInModeWithFilter + 99
    56  AppKit                              0x90bd8721 _DPSNextEvent + 742
    57  AppKit                              0x90bd7dc5 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 350
    58  AppKit                              0x90bcc77c -[NSApplication run] + 907
    59  AppKit                              0x90b41bc0 NSApplicationMain + 2082
    60  Unity                               0x016d78bb _Z10EditorMainiPPKc + 1339
    61  Unity                               0x016d7ff8 main + 24
    62  Unity                               0x00003435 start + 53

Debug info from gdb:


=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Unity(7142,0xa0cba1d4) malloc: *** error for object 0x241b9000: Can't deallocate_pages region
Unity(7142,0xa0cba1d4) malloc: *** set a breakpoint in malloc_error_break to debug

[help]OSX built slua bundle doesn't work properly on Unity5.0

image
course LuaDLL.luaL_newstate() return null. the prebuilt slua.bundle from git works right.

my slua.bundle xcode project compile slua.c and link with just built libluajit_x86.a and libluajit_x86_64.a to generate the universal bundle. is there any specific build settings need to apply?
image

I build the luajit using following script:

cd luajit
make clean
make CC="gcc -m32" BUILDMODE=static
cp src/libluajit.a ../osx/libluajit_x86.a

make clean
make CC="gcc" BUILDMODE=static
cp src/libluajit.a ../osx/libluajit_x86_64.a

another hint is I found my slua.bundle(nearly 1M) much bigger than prebuilt one from git(397k)

slua应该避免unity crash

很多情况下,预设修改后,点apply并不会立即保存到硬盘上,而是unity3d退出的时候才存盘。当unity3d crash的时候,预设修改就不会存盘而直接丢失。

所以建议slua应该避免unity crash.

参数为Vector3[]时候类型匹配不上

EG:C#
class Helper{
//重载方法中有 数组
public static void move(GameObject obj,Vector3[] paths,float t){}
//有重载方法
public static void move(GameObject obj,Vector pos,float t){}
}
上面的函数会调用不了
lua
local paths={}
table.insert(paths,Vector3(0.1,1,0))
table.insert(paths,Vector3(1.1,1,2.3))
Helper. move(go,paths,1)

报错 No matched override function to call

Pass binary string from c# to lua

c# code:

    byte[] bytes = {0,0,0,0};
    string str = System.Text.Encoding.UTF8.GetString(bytes);
    callback(str);

lua code:

    callback = {'+=',function ( str )
        print(string.len(str))
    end}

The length of str received in lua is 0.

I have googled it and got an answer:
http://stackoverflow.com/questions/3722060/passing-a-c-sharp-byte-array-to-luainterface

Finally traced it down to a the call to ::lua_pushstring() in lapi.c. It called strlen() on the char* passed in. Since my first byte of data was 0, it returned 0. There is an alternate call, lua_pushlstring, that accepts the size of the string as an argument. Changing to call this function fixed the issue.

Is there a way to handle exception from doString()?

I coded something like this:

Lua = new LuaSvr();
Lua.init(null, LoadLuaComplete, false);
try
{
Lua.luaState.doString("someUncaughtException()", "chunkName");
}
catch (Exception e)
{
Debug.Log(e.message);
}

But it cannot caught an error in lua. What should I do?

lua string include zero bytes cannot pass to function receive byte[] parameter

in C#

void foo(byte[]) {
}

// binding code is
MyType self=(MyType)checkSelf(l);
System.Byte[] a1;
checkType(l,2,out a1);
self.foo(a1);

it doesn't work because no string to byte[] conversion allowed directly.

so I have to write my own MonoPInvoke function like:

[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static public int foo(IntPtr l) {
    MyType self=(MyType)LuaObject.checkSelf(l);
    int bytesLen;
    IntPtr ptr = LuaDLL.lua_tolstring(l, 2, out bytesLen);
    byte[] bytes = new byte[bytesLen];
    for (int i = 0; i < bytesLen; ++i) {
        bytes[i] = (byte)Marshal.ReadByte(ptr, i);
    }
    self.foo(bytes);
}

If the engine can include this kind of conversion code, it will be better.

I think maybe I should fork slua and send some pull request :)

Subscribe to C# Events in Lua

Thank you for your response to my other posts.

I was wondering if SLua supported subscribing to C# events? I can see why this might be difficult/impossible, but wanted to see if you had any solution?

Thanks

3rdDLL and custom export same Type lead to compile error

Assets/Slua/LuaObject/Dll/LuaDelegate_UIEventListener_VoidDelegate.cs(12,29): error CS0111: A member `SLua.LuaDelegation.checkDelegate(System.IntPtr, int, out UIEventListener.VoidDelegate)' is already defined. Rename this member or use different parameter types

Nested Classes

Hi,
We were experimenting with using Nested classes and noticed that Slua does not seem to be compatible. Specifically, when we use the [CustomLuaClass] attribute on a nested class, these classes are appended to their container class with a "+", which causes compilation to fail.

Generate code under System namespace

Hi,

In the OnAddCustomClass I added the following:
list.Add(typeof(System.IO.Directory));

But the code generated has a lot of compilation errors. The same happens to a lot of other classes under System as well.

A workaround is to write some custom wrapper class calling into those system classes, but a working native support would awesome.

Error in Unity 5.2.1p1

When I tried to run the demo in Unity 5.2.1p1 in Unity Editor, it said:

UNetWeaver error: Exception :System.ArgumentException: An element with the same key already exists in the dictionary.
at System.Collections.Generic.Dictionary2[System.UInt32,System.UInt32].Add (UInt32 key, UInt32 value) [0x0007e] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404 at Mono.Cecil.MetadataSystem.SetReverseNestedTypeMapping (UInt32 nested, UInt32 declaring) [0x00000] in <filename unknown>:0 at Mono.Cecil.MetadataReader.AddNestedMapping (UInt32 declaring, UInt32 nested) [0x00000] in <filename unknown>:0 at Mono.Cecil.MetadataReader.InitializeNestedTypes () [0x00000] in <filename unknown>:0 at Mono.Cecil.MetadataReader.InitializeTypeDefinitions () [0x00000] in <filename unknown>:0 at Mono.Cecil.MetadataReader.ReadTypes () [0x00000] in <filename unknown>:0 at Mono.Cecil.ModuleDefinition.<get_Types>b__8 (Mono.Cecil.ModuleDefinition _, Mono.Cecil.MetadataReader reader) [0x00000] in <filename unknown>:0 at Mono.Cecil.ModuleDefinition.Read[ModuleDefinition,TypeDefinitionCollection] (Mono.Cecil.TypeDefinitionCollection& variable, Mono.Cecil.ModuleDefinition item, System.Func3 read) [0x00000] in :0
at Mono.Cecil.ModuleDefinition.get_Types () [0x00000] in :0
at Unity.UNetWeaver.Weaver.Weave (System.String assName, IEnumerable1 dependencies, IAssemblyResolver assemblyResolver, System.String unityEngineDLLPath, System.String unityUNetDLLPath, System.String outputDir) [0x0006a] in /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1546 at Unity.UNetWeaver.Weaver.WeaveAssemblies (IEnumerable1 assemblies, IEnumerable1 dependencies, IAssemblyResolver assemblyResolver, System.String outputDir, System.String unityEngineDLLPath, System.String unityUNetDLLPath) [0x00062] in /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1637 UnityEngine.Debug:LogError(Object) Unity.UNetWeaver.Log:Error(String) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:20) Unity.UNetWeaver.Weaver:WeaveAssemblies(IEnumerable1, IEnumerable1, IAssemblyResolver, String, String, String) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/UNetWeaver.cs:1644) Unity.UNetWeaver.Program:Process(String, String, String, String[], String[], IAssemblyResolver, Action1, Action`1) (at /Users/builduser/buildslave/unity/build/Extensions/Networking/Weaver/Program.cs:34)
UnityEditor.Scripting.Serialization.Weaver:WeaveUnetFromEditor(String, String, String, String, Boolean)

and

Failure generating network code.
UnityEditor.Scripting.Serialization.Weaver:WeaveUnetFromEditor(String, String, String, String, Boolean)

I can run it in 5.1.3 in Unity Editor perfectly without a problem.

Stolen code

I wrote uLua, and you use stolen code. I have proof, and if you don't remove this project I will use legal means to have it removed.

When you purchased uLua it did not give permission for you to reuse code owned by me and PNG for your own releases. This is your only warning.

iOS ARM64 luajit (lua5.1)下LuaDLL.lua_pushinteger的bug

(32位平台不受影响;lua5.3不受影响)

unity3d的c#重现代码:

l.luaState.doString("print(a)"); // expect: nil, result: nil
LuaDLL.lua_pushinteger(l.luaState.L, -1);
LuaDLL.lua_setglobal(l.luaState.L, "a");
l.luaState.doString("print(a)"); // expect: -1, result: 4294967295

LuaDLL.lua_getglobal(l.luaState.L, "a");
Debug.Log(LuaDLL.lua_tonumber(l.luaState.L, -1)); // expect: -1, reulst: 4294967295
LuaDLL.lua_pop(l.luaState.L, 1);

原因:

因为在arm64下,编译的lua库ptrdiff_t实际等于:int64_t,(PInvokeFunc)lua_pushinteger强转后,函数定义不一致,导致 lua_pushinteger接受第二个参数错误。

临时解决方案

修改LuaDLL.cs文件中:
public static extern void lua_pushinteger(IntPtr luaState, int i);

public static extern void lua_pushinteger(IntPtr luaState, Int64 i);

分析参考

lua5.1文档中:

typedef ptrdiff_t lua_Integer;
void lua_pushinteger (lua_State *L, lua_Integer n);

LuaDLL.cs中对于lua5.1:

public static extern void lua_pushinteger(IntPtr luaState, int i);

转换为il2cpp:

// System.Void LuaInterface.LuaDLL::lua_pushinteger(System.IntPtr,System.Int32)
extern "C" {void CDECL lua_pushinteger(intptr_t, int32_t);}
extern "C" void LuaDLL_lua_pushinteger_m4400 (Object_t * __this /* static, unused */, IntPtr_t ___luaState, int32_t ___i, const MethodInfo* method)
{
    typedef void (CDECL *PInvokeFunc) (intptr_t, int32_t);
    static PInvokeFunc _il2cpp_pinvoke_func;
    if (!_il2cpp_pinvoke_func)
    {
        _il2cpp_pinvoke_func = (PInvokeFunc)lua_pushinteger;

        if (_il2cpp_pinvoke_func == NULL)
        {
            il2cpp_codegen_raise_exception((Il2CppCodeGenException*)il2cpp_codegen_get_not_supported_exception("Unable to find method for p/invoke: 'lua_pushinteger'"));
        }
    }

    // Marshaling of parameter '___luaState' to native representation

    // Marshaling of parameter '___i' to native representation

    // Native function invocation
    _il2cpp_pinvoke_func(reinterpret_cast<intptr_t>((___luaState).___m_value_0), ___i);

    // Marshaling cleanup of parameter '___luaState' native representation

    // Marshaling cleanup of parameter '___i' native representation

}

c语言重现例子:

#include <stdio.h>
#include <stdint.h>
void test1(int64_t i)
{
    printf("%lld\n", i); // result: 4294967295
}

int main()
{
    typedef void (*PInvokeFunc) (int32_t);

    static PInvokeFunc _il2cpp_pinvoke_func;
    if (!_il2cpp_pinvoke_func)
    {
        _il2cpp_pinvoke_func = (PInvokeFunc)test1;
    }

    int32_t i = -1;
    _il2cpp_pinvoke_func(i);
    return 0;
}

Stack is left inflated by missing pop in LuaObject_basetype.cs checkType(IntPtr l, int p, out Type t)

I was encountering an issue where the stack size (top) was increased after a binding called checkType. This confused a checkParams call later on because checkParams thought it had more inputs than it actually had (because top was increased).

Within the LuaTypes.LUA_TTABLE switch case, if the __type rawget pushes a nil value on to the stack, then the else case immediately does another rawget for __fullname without ever popping the nil value from __type off the stack. Now, both the values for __type and __fullname are on the stack, and the pop at the end of the else case only pops the __fullname value, but does not pop the nil value from __type.

I believe a fix is to add another pop at the beginning of the else case, right before pushing the __fullname string.

Error in checkType() when managed Vector3[] value is passed from luastate to managed function

https://github.com/pangweiwei/slua/blob/master/Assets/Slua/Script/LuaObject_overload.cs#L56-L68

I attempt to pass Managed Vector3[] object as parameter from luastate to c sharp function.
but, an error is occurred.

following example code.

  • in C#
    [SLua.StaticExport] static public void Path(Transform target, Vector3[] path, float duration, string pathType, string ease, bool orientToPath = true) {
  • luascript
    Path(params.root.transform, GetPath(params), params.event:GetValue('m_movingTime'), 'CatmullRom', 'Linear', params.event:GetValue('m_orientToPath'))

return type of GetPath is Managed Vector3[] object.

I wish you resolve this problem in your way, if you want.

thanks.

windows 64bit Lua 5.3, unity crash when using table after calling a coroutine.

Build lua5.3 64bit tested in unity5, unity4.6.4(32bit), add macro LUA_5_3 in script,
modify last line of "resumefunc" in LuaState.cs from "return unpack(ret)" to "return table.unpack(ret)".
Then test main.unity, the editor will crash with error:
---------------mono.dll caused an Access Violation (0xc0000005)
---------------in module mono.dll at 0033:ed8d331a.

I test the code, and found that the crash caused by visiting a table after using coroutine, the short example to produce the issue:
local c = coroutine.create(function()
Yield(WaitForSeconds(2)) --<--------------- works fine if this line is commented
end)
coroutine.resume(c) --<--------------- works fine if this line is commented
local x=UnityEngine.GameObject("OoOo")
print(x) --<---------------- you will get a crash

Debug in mono, found:
internal static int print(IntPtr L)
{
int n = LuaDLL.lua_gettop(L); --<---------------------------- crashed after calling this
...

BTW, I build the slua.dll with vc2013, Is there anything wrong if i setup a project and build dll with vc2013 ?
Did not find the reason yet...

LuaState close does not actually close (as described by its own comments), plus another bug when re-enabling closing

I've been intentionally closing my LuaState objects for awhile, believing that was closing the LuaVMs. I was very confused by why my Unity editor sometimes would fail to allocate new pointers in my native extensions. I eventually discovered the comments in LuaState:

                // be careful, if you close lua vm, make sure you don't use lua state again,
                // comment this line as default for avoid unexpected crash.
                // LuaDLL.lua_close(L);
                // L = IntPtr.Zero;

This was very surprising to me. While it's nice that the comments are there describing why you commented those lines out, there's nothing leading users of Slua to those comments. Either way, not closing the lua VM because of an "unexpected crash" is simply hiding other issue with the user's code if those crashes occur. Indeed, once I added the lua_close back, I did not start to experience other issues, but those issues were real and needed to be fixed.

In fact, one of the issues I discovered by re-adding lua_close was a rare (but very annoying) bug with Slua. In ObjectCache.del, the lua state is correctly removed from the multiState map, BUT oldl and oldoc are not cleared out (set to IntPtr.Zero / null). I believe this leads to a rare condition, where if a lua state is destroyed, and then another is created, the second lua state may have the exact same pointer address as the previous. Because it has the same address as before, the cache incorrectly pulls up the dead cache from oldoc.

Similarly, when a LuaState is closed, it should be removed from LuaState.statemap, and LuaState.oldptr and LuaState.oldstate should be cleared out. This doesn't appear to be happening on master, either.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.