Super-Resume forum
Search
everywhere
only in this topic
Advanced Search
luan for loop syntax?
Classic
List
Threaded
♦
♦
Locked
3 messages
Will
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
luan for loop syntax?
I'm trying to do a for loop in luan, but got syntax errors.
Code is like this
local bullets = parseBullets(html)
for _, b in bullets do
newHtml = newHtml .. "<li>" .. b .. "</li>"
end
Bullets is an array
error is:
Internel Server Error
attempt to call a table value
site:/ai.js.luan line 291 in function 'workSubBulletAdd'
site:/ai.js.luan line 308
Will
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: luan for loop syntax?
I changed to use the following and works.
for i in range (1, #bullets) do
newHtml = newHtml .. "<li>" .. bullets[i] .. "</li>"
end
fschmidt
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: luan for loop syntax?
Administrator
Better is:
for _, b in ipairs(bullets) do newHtml = newHtml .. "<li>" .. b .. "</li>" end
Free forum by Nabble
Edit this page