incomplete lua backport
This commit is contained in:
parent
19259b0dbf
commit
4b27834e48
3 changed files with 6 additions and 5 deletions
|
@ -913,7 +913,7 @@ static void generate_and_push_ai_table(lua_State* L, ai::engine_lua* engine) {
|
|||
|
||||
lua_ai_context* lua_ai_context::create(lua_State *L, char const *code, ai::engine_lua *engine)
|
||||
{
|
||||
int res_ai = luaL_loadstring(L, code);//stack size is now 1 [ -1: ai_context]
|
||||
int res_ai = luaL_loadstringx(L, code, strlen(code), /*name*/ code, "t");//stack size is now 1 [ -1: ai_context]
|
||||
if (res_ai)
|
||||
{
|
||||
|
||||
|
@ -943,7 +943,7 @@ lua_ai_context* lua_ai_context::create(lua_State *L, char const *code, ai::engin
|
|||
|
||||
lua_ai_action_handler* lua_ai_action_handler::create(lua_State *L, char const *code, lua_ai_context &context)
|
||||
{
|
||||
int res = luaL_loadstring(L, code);//stack size is now 1 [ -1: f]
|
||||
int res = luaL_loadstringx(L, code, strlen(code), /*name*/ code, "t");//stack size is now 1 [ -1: f]
|
||||
if (res)
|
||||
{
|
||||
char const *m = lua_tostring(L, -1);
|
||||
|
|
|
@ -310,16 +310,17 @@ static int luaB_load (lua_State *L) {
|
|||
size_t l;
|
||||
const char *s = lua_tolstring(L, 1, &l);
|
||||
const char *mode = luaL_optstring(L, 3, "bt");
|
||||
(void) mode;
|
||||
int env = (!lua_isnone(L, 4) ? 4 : 0); /* 'env' index or 0 if no 'env' */
|
||||
if (s != NULL) { /* loading a string? */
|
||||
const char *chunkname = luaL_optstring(L, 2, s);
|
||||
status = luaL_loadbufferx(L, s, l, chunkname, mode);
|
||||
status = luaL_loadbufferx(L, s, l, chunkname, "t");
|
||||
}
|
||||
else { /* loading from a reader function */
|
||||
const char *chunkname = luaL_optstring(L, 2, "=(load)");
|
||||
luaL_checktype(L, 1, LUA_TFUNCTION);
|
||||
lua_settop(L, RESERVEDSLOT); /* create reserved slot */
|
||||
status = lua_load(L, generic_reader, NULL, chunkname, mode);
|
||||
status = lua_load(L, generic_reader, NULL, chunkname, "t");
|
||||
}
|
||||
return load_aux(L, status, env);
|
||||
}
|
||||
|
|
|
@ -1052,7 +1052,7 @@ public:
|
|||
//lua uses '@' to know that this is a file (as opposed to a something as opposed to something loaded via loadstring )
|
||||
std::string chunkname = '@' + fname;
|
||||
LOG_LUA << "starting to read from " << fname << "\n";
|
||||
return lua_load(L, &lua_filestream::lua_read_data, &lfs, chunkname.c_str(), NULL);
|
||||
return lua_load(L, &lua_filestream::lua_read_data, &lfs, chunkname.c_str(), "t");
|
||||
}
|
||||
private:
|
||||
char buff_[LUAL_BUFFERSIZE];
|
||||
|
|
Loading…
Add table
Reference in a new issue