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

Function CheckHashOrString

engine/script/src/script_hash.cpp:292–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290 }
291
292 dmhash_t CheckHashOrString(lua_State* L, int index)
293 {
294 dmhash_t* phash = ToHash(L, index);
295 if (phash != 0)
296 {
297 return *phash;
298 }
299 else if( lua_type(L, index) == LUA_TSTRING )
300 {
301 size_t len = 0;
302 const char* s = lua_tolstring(L, index, &len);
303 return dmHashBuffer64(s, len);
304 }
305
306 luaL_typerror(L, index, "hash or string expected");
307 return 0;
308 }
309
310 const char* GetStringFromHashOrString(lua_State* L, int index, char* buffer, uint32_t bufferlength)
311 {

Callers 15

ParsePropertyOptionKeyFunction · 0.85
ParsePropertyOptionKeysFunction · 0.85
Resource_RemoveMountFunction · 0.85
Resource_AddMountFunction · 0.85
CheckRenderTargetFunction · 0.85
RenderScript_PredicateFunction · 0.85
RenderScript_SetComputeFunction · 0.85
LuaGetFunction · 0.85
LuaSetFunction · 0.85

Calls 5

ToHashFunction · 0.85
lua_typeFunction · 0.85
lua_tolstringFunction · 0.85
dmHashBuffer64Function · 0.50
luaL_typerrorFunction · 0.50

Tested by

no test coverage detected