SWORD25: Make Lua package registering more robust.

svn-id: r53242
This commit is contained in:
Eugene Sandulenko 2010-08-14 22:27:59 +00:00
parent 4b1b3e5034
commit 06fc35ffe8

View File

@ -325,11 +325,11 @@ bool BS_LuaBindhelper::GetMetatable(lua_State *L, const Common::String &TableNam
bool BS_LuaBindhelper::_CreateTable(lua_State *L, const Common::String &TableName) {
const char *PartBegin = TableName.c_str();
while (*PartBegin) {
while (PartBegin - TableName.c_str() < (int)TableName.size()) {
const char *PartEnd = strchr(PartBegin, '.');
if (!PartEnd)
PartEnd = PartBegin + strlen(PartBegin);
Common::String SubTableName(PartBegin, PartEnd - PartBegin);
Common::String SubTableName(PartBegin, PartEnd);
// Tables with an empty string as the name are not allowed
if (SubTableName.size() == 0)