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

Function Resource_AddMount

engine/liveupdate/src/script_liveupdate.cpp:130–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128 }
129
130 static int Resource_AddMount(lua_State* L)
131 {
132 DM_LUA_STACK_CHECK(L, 1);
133
134 dmhash_t name_hash = dmScript::CheckHashOrString(L, 1);
135 const char* uri = luaL_checkstring(L, 2);
136 int priority = luaL_checkinteger(L, 3);
137
138 // validate args
139 if (priority < 0)
140 return DM_LUA_ERROR("Priority needs to be a positive number: %d", priority);
141
142 if (IsReservedMountName(name_hash))
143 return DM_LUA_ERROR("Cannot add reserved mount: " DM_HASH_FMT, name_hash);
144
145 // options at #5
146
147 dmScript::LuaCallbackInfo* cbk = dmScript::CreateCallback(L, 4);
148 dmLiveUpdate::Result res = dmLiveUpdate::AddMountAsync(name_hash, uri, priority, Callback_AddMount, cbk);
149 if (dmLiveUpdate::RESULT_OK != res)
150 {
151 dmLogError("The liveupdate mount " DM_HASH_FMT " - '%s' was not stored: %s", name_hash, uri, dmLiveUpdate::ResultToString(res));
152 dmScript::DestroyCallback(cbk);
153 }
154
155 lua_pushinteger(L, res);
156 return 1;
157 }
158
159 static int Resource_IsBuiltWithExcludedFiles(lua_State* L)
160 {

Callers

nothing calls this directly

Calls 8

CheckHashOrStringFunction · 0.85
luaL_checkintegerFunction · 0.85
IsReservedMountNameFunction · 0.85
CreateCallbackFunction · 0.85
AddMountAsyncFunction · 0.85
DestroyCallbackFunction · 0.85
lua_pushintegerFunction · 0.85
ResultToStringFunction · 0.70

Tested by

no test coverage detected