lua - require support; if child resource fails to load resource, parent fails to load as well

This commit is contained in:
Mikulas Florek 2015-05-17 22:56:37 +02:00
parent 278a693727
commit d410881377
3 changed files with 7 additions and 1 deletions

View file

@ -114,7 +114,11 @@ namespace Lumix
void Resource::onStateChanged(State old_state, State new_state)
{
if (State::READY == new_state || State::FAILURE == new_state)
if (State::FAILURE == new_state)
{
onFailure();
}
else if (State::READY == new_state)
{
decrementDepCount();
}

View file

@ -193,6 +193,7 @@ struct PipelineImpl : public Pipeline
if(success)
{
m_lua_state = luaL_newstate();
luaL_openlibs(m_lua_state);
bool errors = luaL_loadbuffer(m_lua_state, (const char*)file->getBuffer(), file->size(), "") != LUA_OK;
errors = errors || lua_pcall(m_lua_state, 0, LUA_MULTRET, 0) != LUA_OK;
if (errors)

View file

@ -248,6 +248,7 @@ void Shader::loaded(FS::IFile* file, bool success, FS::FileSystem& fs)
if(success)
{
lua_State* L = luaL_newstate();
luaL_openlibs(L);
bool errors = luaL_loadbuffer(L, (const char*)file->getBuffer(), file->size(), "") != LUA_OK;
errors = errors || lua_pcall(L, 0, LUA_MULTRET, 0) != LUA_OK;