| 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 | { |
nothing calls this directly
no test coverage detected