MCPcopy Create free account
hub / github.com/DFHack/dfhack / lua_parseLightCell

Function lua_parseLightCell

plugins/rendermax/renderer_light.cpp:902–923  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

900
901}
902rgbf lua_parseLightCell(lua_State* L)
903{
904 rgbf ret;
905
906 lua_pushnumber(L,1);
907 lua_gettable(L,-2);
908 ret.r=lua_tonumber(L,-1);
909 lua_pop(L,1);
910
911 lua_pushnumber(L,2);
912 lua_gettable(L,-2);
913 ret.g=lua_tonumber(L,-1);
914 lua_pop(L,1);
915
916 lua_pushnumber(L,3);
917 lua_gettable(L,-2);
918 ret.b=lua_tonumber(L,-1);
919 lua_pop(L,1);
920
921 //Lua::GetOutput(L)->print("got cell(%f,%f,%f)\n",ret.r,ret.g,ret.b);
922 return ret;
923}
924#define GETLUAFLAG(field,name) lua_getfield(L,-1,"flags");\
925 if(lua_isnil(L,-1)){field=false;}\
926 else{lua_getfield(L,-1,#name);field=lua_isnil(L,-1);lua_pop(L,1);}\

Callers 2

lua_parseMatDefFunction · 0.85
parseSpecialMethod · 0.85

Calls 2

lua_pushnumberFunction · 0.85
lua_gettableFunction · 0.85

Tested by

no test coverage detected