From b19f007bd2449f635780078e61a174f19838b32d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 20 Nov 2012 14:11:34 +0000 Subject: lua: Use lua_rawgeti to read elements from lists of strings. This is faster, but more importantly it avoids the strange error 'lua: attempt to index a string value' which appears with (some) single element lists. --- generator/lua.ml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/generator/lua.ml b/generator/lua.ml index 7e5779f6..67f18243 100644 --- a/generator/lua.ml +++ b/generator/lua.ml @@ -600,8 +600,7 @@ get_string_list (lua_State *L, int index) } for (i = 0; i < len; ++i) { - lua_pushinteger (L, i+1 /* because of base 1 arrays */); - lua_gettable (L, index); + lua_rawgeti (L, index, i+1 /* because of base 1 arrays */); strs[i] = (char *) luaL_checkstring (L, -1); lua_pop (L, 1); } -- cgit