Quote:
Originally Posted by deeb
per example:
Code:
doSomething = function(arg)
-- doSomething
end
local menus ={}
for i=1, 20 do
table.insert(menus, {"line"..1, doSomething(i)} )
end
...
How would you solve this?
Thanks a lot!
|
v3 will allow you to specify parameters when you create the menu just like you can with Buttons, but in the meantime you can use a
closure - a wrapper function that calls the "real" function with the parameter you want.
Instead of:
Code:
local menus = {
{title = "File", options = {
{"New", mnu_file.new},
Do:
Code:
local menus = {
{title = "File", options = {
{"New", function() mnu_file.new(someParameter) end},