ipairs in LUA
BlitzMax Forums/BlitzMax Programming/ipairs in LUA
| ||
function Update(argh) local trev = {} trev[1]=x trev[2]=y trev.x=111 trev.y=222 for i,v in ipairs(trev) do print (i.."-"..v) end end When i run this script it says : attempt to call global ipairs 'a nil value' |
| ||
Did you load all libraries? By default no libraries are loaded so that might be the reason you get a message that ipairs doesn't exists. |
| ||
oh yeah thanks |
| ||
i put lual_openlibs in the blitzmax source, does there have to be something in the LUA source to open libraries? |
| ||
Try using pairs() instead of ipairs() Also, I suggest you use the pil as a reference/tutorial. It's a great Lua book. |
| ||
I got it to work now, thanks for all the help |
| ||
does anyone know how to know what type of object is given by the pairs functions? e.g. string, integer, table I checked the manual but could only find functions like that in the host program. |
| ||
Can't you obtain the type with print(type(ipairs(trev))) ? |
| ||
oh yeah 'type' is the command thanks |