traceback: Object.lua:21: in function 'draw'
main.lua:24: in function 'draw' [string "boot.lua"]:410: in function <[string "boot.lua"]73> [C]: in function 'xpcall'
how to fix? was trying to call a variable within a function name but dont know how... help?
Code: Select all
object = {}
object.list = {}
objectamount = 2
object.requireList = {
--make sure to change the for loop in the object.require function.
[1] = "test1",
[2] = "test2"
}
function object.require()
--for the number of objects in "object.require_list", address each object handler with it's respective ids and call them with the "require()" function.
print(object.requireList[1] .. ".draw")
for i=1, objectamount, 1 do
require(object.requireList[i])
print("Loaded " .. object.requireList[i])
end
end
function object.draw()
for i=1, objectamount, 1 do
_g[object.requireList[i] .. ".draw"]()
end
end