I have a C function that can access Lua variables in a Lua standalone environment that doesn't work in MarketScope (Indicore). The function tries to access arrays like this:
In Lua:
List1 = {68.9, 70.2}
List2 = {54.8, 52.1}
In C:
double array1[20];
int i =0, n=0;
lua_getglobal(L, "List1");
n = luaL_getn(L, 1);
for (int i=0; i < n; i++) {
lua_pushnumber(L, i + 1);
lua_rawgeti(L, -2, i + 1);
array1[i] = lua_tonumber(L, -1);
lua_pop(L, 2);
}
This code gets nothing. I've tried making the variables global, but that didn't work either. Is the only way to get an array (table) from Lua to C in Indicore through the parameter stack? Is there an easier way to make variables visible between the two environments? In any case, does anyone have sample code for getting arrays (tables) from Lua to C in the Indicore environment? [And vice versa]