MCPcopy Create free account
hub / github.com/defold/defold / GetLuaSource

Function GetLuaSource

engine/script/src/script_module.cpp:46–56  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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 {

Callers 3

LuaLoadFunction · 0.85
AddModuleFunction · 0.85
ReloadModuleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected