MCPcopy Create free account
hub / github.com/Tencent/xLua / getObject

Method getObject

Assets/XLua/Src/ObjectCasters.cs:335–391  ·  view source on GitHub ↗
(RealStatePtr L, int idx, object target)

Source from the content-addressed store, hash-verified

333 }
334
335 private object getObject(RealStatePtr L, int idx, object target)
336 {
337 //return translator.getObject(L, idx); //TODO: translator.getObject move to here??
338 LuaTypes type = (LuaTypes)LuaAPI.lua_type(L, idx);
339 switch (type)
340 {
341 case LuaTypes.LUA_TNUMBER:
342 {
343 if (LuaAPI.lua_isint64(L, idx))
344 {
345 return LuaAPI.lua_toint64(L, idx);
346 }
347 else if(LuaAPI.lua_isinteger(L, idx))
348 {
349 return LuaAPI.xlua_tointeger(L, idx);
350 }
351 else
352 {
353 return LuaAPI.lua_tonumber(L, idx);
354 }
355 }
356 case LuaTypes.LUA_TSTRING:
357 {
358 return LuaAPI.lua_tostring(L, idx);
359 }
360 case LuaTypes.LUA_TBOOLEAN:
361 {
362 return LuaAPI.lua_toboolean(L, idx);
363 }
364 case LuaTypes.LUA_TTABLE:
365 {
366 return getLuaTable(L, idx, null);
367 }
368 case LuaTypes.LUA_TFUNCTION:
369 {
370 return getLuaFunction(L, idx, null);
371 }
372 case LuaTypes.LUA_TUSERDATA:
373 {
374 if (LuaAPI.lua_isint64(L, idx))
375 {
376 return LuaAPI.lua_toint64(L, idx);
377 }
378 else if(LuaAPI.lua_isuint64(L, idx))
379 {
380 return LuaAPI.lua_touint64(L, idx);
381 }
382 else
383 {
384 object obj = translator.SafeGetCSObj(L, idx);
385 return (obj is RawObject) ? (obj as RawObject).Target : obj;
386 }
387 }
388 default:
389 return null;
390 }
391 }
392

Callers

nothing calls this directly

Calls 11

lua_typeMethod · 0.80
lua_isint64Method · 0.80
lua_toint64Method · 0.80
lua_isintegerMethod · 0.80
xlua_tointegerMethod · 0.80
lua_tonumberMethod · 0.80
lua_tostringMethod · 0.80
lua_tobooleanMethod · 0.80
lua_isuint64Method · 0.80
lua_touint64Method · 0.80
SafeGetCSObjMethod · 0.80

Tested by

no test coverage detected