lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi

As I got some very helpful feedback on my previous porting issues, I thought I would ask about the next one just in case anyone can make a guess as to what I might have screwed up, or maybe some further debugging suggestions. The Lua run time error shows something pretty fundamental has got broken.

Issue 3

a) Simple test scripts all seem to compile to bytecode OK (luaL_loadfile() returns 0 )

b) I get run time errors as follows:

print(1) --> gives "Lua Error: attempt to call a table value"

a=os.clock() --> gives "Lua Error: C:\test.lua:2: attempt to call field 'clock' (a nil value)"

a=math.abs(-2) --> gives "Lua Error: C:\test.lua:1: attempt to call field 'abs' (a nil value)"


If I run a script
a=1
b=2
c=a+b
This runs OK, lua_pcall(L,0,0) returns 0


So far I am guessing that the global table _G (or maybe the baselibs) is either not getting set up properly or is subsequently getting cleared/trashed. Debugging is a bit problematic as I cant get the Lua print() to work so cant see very easily what the _G table looks like.
Any speculation/ideas gratefully accepted
Thanks Geoff