private static int Str_Dump(ILuaState lua) { lua.L_CheckType(1, LuaType.LUA_TFUNCTION); lua.SetTop(1); var bsb = new ByteStringBuilder(); LuaWriter writeFunc = delegate(byte[] bytes, int start, int length) { bsb.Append(bytes, start, length); return(DumpStatus.OK); }; if (lua.Dump(writeFunc) != DumpStatus.OK) { return(lua.L_Error("unable to dump given function")); } lua.PushString(bsb.ToString()); return(1); }
private static int Str_Dump( ILuaState lua ) { lua.L_CheckType( 1, LuaType.LUA_TFUNCTION ); lua.SetTop( 1 ); var bsb = new ByteStringBuilder(); LuaWriter writeFunc = delegate(byte[] bytes, int start, int length) { bsb.Append(bytes, start, length); return DumpStatus.OK; }; if( lua.Dump( writeFunc ) != DumpStatus.OK ) return lua.L_Error( "unable to dump given function" ); lua.PushString( bsb.ToString() ); return 1; }