@@ -298,10 +298,10 @@ public static int lua_yield(IntPtr luaState,int nrets) {
298298
299299[ DllImport ( LUADLL , CallingConvention = CallingConvention . Cdecl ) ]
300300public static extern int lua_resume ( IntPtr L , IntPtr from , int narg ) ;
301- public static int lua_resume ( IntPtr L , int narg )
302- {
303- return lua_resume ( L , IntPtr . Zero , narg ) ;
304- }
301+ public static int lua_resume ( IntPtr L , int narg )
302+ {
303+ return lua_resume ( L , IntPtr . Zero , narg ) ;
304+ }
305305
306306public static void lua_replace ( IntPtr luaState , int index ) {
307307lua_copy ( luaState , - 1 , ( index ) ) ;
@@ -585,19 +585,19 @@ public static string lua_tostring(IntPtr luaState, int index)
585585int strlen ;
586586
587587IntPtr str = luaS_tolstring32 ( luaState , index , out strlen ) ; // fix il2cpp 64 bit
588- string s = null ;
589- if ( strlen > 0 && str != IntPtr . Zero )
588+ string s = null ;
589+ if ( strlen > 0 && str != IntPtr . Zero )
590590{
591- s = Marshal . PtrToStringAnsi ( str ) ;
592- // fallback method
593- if ( s == null )
594- {
595- byte [ ] b = new byte [ strlen ] ;
596- Marshal . Copy ( str , b , 0 , strlen ) ;
597- s = System . Text . Encoding . Default . GetString ( b ) ;
598- }
591+ s = Marshal . PtrToStringAnsi ( str ) ;
592+ // fallback method
593+ if ( s == null )
594+ {
595+ byte [ ] b = new byte [ strlen ] ;
596+ Marshal . Copy ( str , b , 0 , strlen ) ;
597+ s = System . Text . Encoding . Default . GetString ( b ) ;
598+ }
599599}
600- return ( s == null ) ? string . Empty : s ;
600+ return ( s == null ) ? string . Empty : s ;
601601}
602602
603603public static byte [ ] lua_tobytes ( IntPtr luaState , int index )
@@ -692,12 +692,13 @@ public static double luaL_checknumber(IntPtr luaState, int stackPos)
692692
693693/// <summary>
694694/// //check the data in the stack postion index is a userData, or it's most __base is a userData.
695- /// if is, return the userdata(which is a int index) or -1 if it's not
696- /// ref luaS_pushobject
695+ /// TODO: where is the __base got set??
696+ /// if is, return the userdata(which is a int index) or -1 if it's not
697+ /// ref luaS_pushobject
697698/// </summary>
698699/// <param name="luaState"></param>
699- /// <param name="obj">the index in stack</param>
700- /// <returns>the index of cache list</returns>
700+ /// <param name="obj">the index in stack</param>
701+ /// <returns>the index of cache list</returns>
701702[ DllImport ( LUADLL , CallingConvention = CallingConvention . Cdecl ) ]
702703public static extern int luaS_rawnetobj ( IntPtr luaState , int obj ) ;
703704
@@ -725,7 +726,7 @@ public static int lua_upvalueindex(int i)
725726public static void lua_pushcclosure ( IntPtr l , LuaCSFunction f , int nup )
726727{
727728#ifSLUA_STANDALONE
728- // Add all LuaCSFunction, or they will be GC collected! (problem at windows, .net framework 4.5, `CallbackOnCollectedDelegated` exception)
729+ // Add all LuaCSFunction, or they will be GC collected! (problem at windows, .net framework 4.5, `CallbackOnCollectedDelegated` exception)
729730GCHandle . Alloc ( f ) ;
730731#endif
731732IntPtr fn = Marshal . GetFunctionPointerForDelegate ( f ) ;
@@ -766,9 +767,9 @@ public static void lua_pushcclosure(IntPtr l, LuaCSFunction f, int nup)
766767public static extern void luaS_setDataVec ( IntPtr l , int p , float x , float y , float z , float w ) ;
767768
768769/// <summary>
769- /// NOTE: Only check lua value type
770+ /// NOTE: Only check lua value type
770771/// 是一个table,并且有metatable,metatable[__typename] == t 如果t != null
771- /// NOTE: where did the metatable got set ? in LuaValueType
772+ /// NOTE: where did the metatable got set ? in LuaValueType
772773/// 返回1 表示true, 0表示FALSE
773774/// </summary>
774775/// <param name="l"></param>
@@ -779,12 +780,12 @@ public static void lua_pushcclosure(IntPtr l, LuaCSFunction f, int nup)
779780public static extern int luaS_checkluatype ( IntPtr l , int p , string t ) ;
780781
781782/// <summary>
782- /// NOTE: the table to be set as metatable for userdata is instance table
783- /// TODO: why does it set the metatable of the userdata(which is the only index value store in it)?
783+ /// NOTE: the table to be set as metatable for userdata is instance table
784+ /// TODO: why does it set the metatable of the userdata(which is the only index value store in it)?
784785/// create an userdata to store index(int), push it on stack(if gco is true, push the userdata to register cref at index index),
785786/// set the metatable of the userdata to
786- /// the table associated to name t(luaL_getmetatable()), which is AQName
787- /// left the userdata on the stack
787+ /// the table associated to name t(luaL_getmetatable()), which is AQName
788+ /// left the userdata on the stack
788789/// </summary>
789790/// <param name="l"></param>
790791/// <param name="index">the index in the cache list</param>
@@ -807,12 +808,12 @@ public static void lua_pushcclosure(IntPtr l, LuaCSFunction f, int nup)
807808
808809
809810/// <summary>
810- /// 如果有__base,则向上查找, 然后判断metatable 的 __typename是否和t相同
811- /// TODO: __base 在哪里设置的 ?
812- /// NOTE: __typename is set in the instance table when create the lua table which represent the c# class
813- /// </summary>
811+ /// 如果有__base,则向上查找, 然后判断metatable 的 __typename是否和t相同
812+ /// TODO: __base 在哪里设置的 ?
813+ /// NOTE: __typename is set in the instance table when create the lua table which represent the c# class
814+ /// </summary>
814815/// <param name="l"></param>
815- /// <param name="index">the luatype at index is a LuaTable</param>
816+ /// <param name="index">the luatype at index is a LuaTable</param>
816817/// <param name="t"></param>
817818/// <returns></returns>
818819[ DllImport ( LUADLL , CallingConvention = CallingConvention . Cdecl ) ]