private Sio.SData format_map(IntPtr L, int index, NParam o) { Sio.SMapWriter pmap = new Sio.SMapWriter(); Sio.SData data = new Sio.SData(pmap); if (LuaAPI.lua_istable(L, index) && o.DType == ParamType.ptype_object) { NStruct ps = NStructManager.GetInstance().Find(o.TypeName); if (ps != null) { LuaAPI.lua_pushnil(L); while (LuaAPI.lua_next(L, index) != 0) { if (LuaAPI.lua_isstring(L, -2)) { NParam findparam = ps.Get(LuaAPI.lua_tostring(L, -2)); if (findparam != null) { pmap.write(findparam.Id, format_data(findparam, L, LuaAPI.lua_gettop(L), true)); } } LuaAPI.lua_pop(L, 1); } } } return(data); }
private Sio.SData format_List(IntPtr L, int index, NParam o) { Sio.SListWriter pl = new Sio.SListWriter(); Sio.SData d = new Sio.SData(pl); if (LuaAPI.lua_istable(L, index)) { int indexsize = (int)LuaAPI.xlua_objlen(L, index); for (int list_index = 1; list_index <= indexsize; ++list_index) { LuaAPI.xlua_rawgeti(L, index, list_index); Sio.SData td = format_data(o, L, LuaAPI.lua_gettop(L), false); pl.add(td); LuaAPI.lua_pop(L, 1); } } return(d); }
private void FormatPackage(Package p, NFunction f, RealStatePtr L) { int startparamnum = 3; IList <NParam> parmlist = f.ParamList; using (MemoryStream ms = new MemoryStream()) { for (int i = 0; i < parmlist.Count; i++) { Sio.SData d = format_data(parmlist[i], L, ++startparamnum, true); if (d != null) { d.Serializ(ms); } } byte[] dbyte = new byte[ms.Length]; Array.Copy(ms.GetBuffer(), dbyte, ms.Length); p.Data = dbyte; } }