| 961 | return ret; |
| 962 | } |
| 963 | int lightingEngineViewscreen::parseMaterials(lua_State* L) |
| 964 | { |
| 965 | auto engine= (lightingEngineViewscreen*)lua_touserdata(L, 1); |
| 966 | engine->matDefs.clear(); |
| 967 | //color_ostream* os=Lua::GetOutput(L); |
| 968 | Lua::StackUnwinder unwinder(L); |
| 969 | lua_getfield(L,2,"materials"); |
| 970 | if(!lua_istable(L,-1)) |
| 971 | { |
| 972 | luaL_error(L,"Materials table not found."); |
| 973 | return 0; |
| 974 | } |
| 975 | lua_pushnil(L); |
| 976 | while (lua_next(L, -2) != 0) { |
| 977 | int type=lua_tonumber(L,-2); |
| 978 | //os->print("Processing type:%d\n",type); |
| 979 | lua_pushnil(L); |
| 980 | while (lua_next(L, -2) != 0) { |
| 981 | int index=lua_tonumber(L,-2); |
| 982 | //os->print("\tProcessing index:%d\n",index); |
| 983 | engine->matDefs[std::make_pair(type,index)]=lua_parseMatDef(L); |
| 984 | |
| 985 | lua_pop(L, 1); |
| 986 | } |
| 987 | lua_pop(L, 1); |
| 988 | } |
| 989 | return 0; |
| 990 | } |
| 991 | #define LOAD_SPECIAL(lua_name,class_name) \ |
| 992 | lua_getfield(L,-1,#lua_name);\ |
| 993 | if(!lua_isnil(L,-1))engine->class_name=lua_parseMatDef(L);\ |
nothing calls this directly
no test coverage detected