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

Function lua_parseMatDef

plugins/rendermax/renderer_light.cpp:932–962  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

930 if(!lua_isnil(L,-1) && lua_isnumber(L,-1))field=lua_tonumber(L,-1);\
931 lua_pop(L,1)
932matLightDef lua_parseMatDef(lua_State* L)
933{
934
935 matLightDef ret;
936 lua_getfield(L,-1,"tr");
937 if((ret.isTransparent=!lua_isnil(L,-1)))
938 {
939 ret.transparency=lua_parseLightCell(L);
940 }
941 lua_pop(L,1);
942
943 lua_getfield(L,-1,"em");
944 if((ret.isEmiting=!lua_isnil(L,-1)))
945 {
946 ret.emitColor=lua_parseLightCell(L);
947 lua_pop(L,1);
948 lua_getfield(L,-1,"rad");
949 if(lua_isnil(L,-1))
950 {
951 lua_pop(L,1);
952 luaL_error(L,"Material has emittance but no radius");
953 }
954 else
955 ret.radius=lua_tonumber(L,-1);
956 lua_pop(L,1);
957 }
958 else
959 lua_pop(L,1);
960 GETLUAFLAG(ret.flicker,"flicker");
961 return ret;
962}
963int lightingEngineViewscreen::parseMaterials(lua_State* L)
964{
965 auto engine= (lightingEngineViewscreen*)lua_touserdata(L, 1);

Callers 4

parseMaterialsMethod · 0.85
parseItemsMethod · 0.85
parseCreaturesMethod · 0.85
parseBuildingsMethod · 0.85

Calls 3

lua_getfieldFunction · 0.85
lua_parseLightCellFunction · 0.85
luaL_errorFunction · 0.85

Tested by

no test coverage detected