public static string[] CheckStringArray(IntPtr L, int stackPos)
{
LuaTypes luatype = LuaDLL.lua_type(L, stackPos);
if (luatype == LuaTypes.LUA_TTABLE)
{
int index = 1;
string retVal = null;
Type t = typeof(string);
List <string> list = new List <string>();
LuaDLL.lua_pushvalue(L, stackPos);
while (true)
{
LuaDLL.lua_rawgeti(L, -1, index);
luatype = LuaDLL.lua_type(L, -1);
if (luatype == LuaTypes.LUA_TNIL)
{
LuaDLL.lua_pop(L, 1);
return(list.ToArray());
}
else if (!TypeChecker.CheckType(L, t, -1))
{
LuaDLL.lua_pop(L, 1);
break;
}
retVal = ToString(L, -1);
list.Add(retVal);
LuaDLL.lua_pop(L, 1);
++index;
}
}
else if (luatype == LuaTypes.LUA_TUSERDATA)
{
return((string[])CheckObject(L, stackPos, typeof(string[])));
}
else if (luatype == LuaTypes.LUA_TNIL)
{
return(null);
}
LuaDLL.luaL_typerror(L, stackPos, "string[]");
return(null);
}