Hi everyone! I just started to learn Lua and have a question.
For example I have a database with information about a player. This database is a table. Then I created a variable hero and want to put all information from database to this variable. But I need them to be as a variables inside a hero. Like hero.name. How it is possible to do?
--\> database.lua local heroInfo = { name = "hero", } return heroInfo --------------------- --\> hero.lua hero = display.newCircle (0,0, 10) heroInfo = require ("database") for key, value in pairs (heroInfo) do hero.key = value end print (hero.name) --\> got nil print (hero.key) --\> "hero" ----------------------
Is it possible to name a variable by the name of key? Thank You!!
Anton Shekhov
