Helper function where the decision is made if to load bytecode or source code. Currently the bytecode is only ever built with LuaJIT which means it cannot be loaded with vanilla lua runtime. The LUA_BYTECODE_ENABLE_(32/62) indicates if we can load bytecode, and in reality, if linking happens against LuaJIT.
| 44 | // with vanilla lua runtime. The LUA_BYTECODE_ENABLE_(32/62) indicates if we can load bytecode, |
| 45 | // and in reality, if linking happens against LuaJIT. |
| 46 | static void GetLuaSource(dmLuaDDF::LuaSource *source, const char **buf, uint32_t *size) |
| 47 | { |
| 48 | if (source->m_Bytecode.m_Count > 0) |
| 49 | { |
| 50 | *buf = (const char*)source->m_Bytecode.m_Data; |
| 51 | *size = source->m_Bytecode.m_Count; |
| 52 | return; |
| 53 | } |
| 54 | *buf = (const char*)source->m_Script.m_Data; |
| 55 | *size = source->m_Script.m_Count; |
| 56 | } |
| 57 | |
| 58 | int LuaLoad(lua_State *L, dmLuaDDF::LuaSource *source) |
| 59 | { |
no outgoing calls
no test coverage detected