MCPcopy Create free account
hub / github.com/BigPig0/RelayLive / _PushValueToLuaTable

Function _PushValueToLuaTable

ThirdParty/lua/luapp/PushToStack.hpp:61–148  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

59#endif
60//------------------------------------------------------------------------------
61inline void _PushValueToLuaTable(lua::NativeState hLua,lua::Table &table)
62{
63 lua::NewTable(hLua); // ... [T]
64
65 lua::Table::Iterator it = table.getBegin();
66
67 lua::Var key;
68 lua::Var value;
69
70 for ( ; ! it.isEnd() ; it++ )
71 {
72 // ... [T]
73
74 it.getKeyValue( &key, &value );
75
76 if ( lua::VarType<lua::Str>(key) )
77 {
78 lua::Str t_key = lua::VarCast<lua::Str>(key);
79 PushVarToLua(hLua,t_key); // ... [T] [key]
80 }
81 else if ( lua::VarType<lua::Int>(key) )
82 {
83 lua::Int t_key = lua::VarCast<lua::Int>(key);
84 PushVarToLua(hLua,t_key); // ... [T] [key]
85 }
86 else if ( lua::VarType<lua::Num>(key) )
87 {
88 lua::Num t_key = lua::VarCast<lua::Num>(key);
89 PushVarToLua(hLua,t_key); // ... [T] [key]
90 }
91 #ifdef _LUAPP_ENABLE_BOOLEAN_INDEX_OF_TABLE_
92 else if ( lua::VarType<lua::Bool>(key) )
93 {
94 lua::Bool t_key = lua::VarCast<lua::Bool>(key);
95 PushVarToLua(hLua,t_key); // ... [T] [key]
96 }
97 #endif
98 else
99 {
100 continue; // Just in case.
101 }
102
103 if ( lua::VarType<lua::Str>(value) )
104 {
105 lua::Str t_value = lua::VarCast<lua::Str>(value);
106 PushVarToLua(hLua,t_value); // ... [T] [key] [value]
107 }
108 else if ( lua::VarType<lua::Int>(value) )
109 {
110 lua::Int t_value = lua::VarCast<lua::Int>(value);
111 PushVarToLua(hLua,t_value); // ... [T] [key] [value]
112 }
113 else if ( lua::VarType<lua::Num>(value) )
114 {
115 lua::Num t_value = lua::VarCast<lua::Num>(value);
116 PushVarToLua(hLua,t_value); // ... [T] [key] [value]
117 }
118 else if ( lua::VarType<lua::Ptr>(value) )

Callers 1

PushVarToLuaFunction · 0.70

Calls 6

isEndMethod · 0.80
getKeyValueMethod · 0.80
NewTableFunction · 0.70
PushVarToLuaFunction · 0.70
PopFunction · 0.70
SetTableFunction · 0.70

Tested by

no test coverage detected