darkshin
New old member
- Joined
- Dec 14, 2010
- Messages
- 231
- Reaction score
- 22
Hey guys!! I'm having a bad time programming here. So I come here to ask for help!
The question is:
"How to make an in lua defined class and call as parameter of a C++ function?"
Explanation:
I have a class in sources like "Creature" and I want to call a function from the sources inside a lua script, the function would be:
So, in my Lua script would look like this:
So when I try to run this code, that returns me an error saying: "attempt to cast a lua number value to class Creature"
Help is appreciated !!
Thanks!!
The question is:
"How to make an in lua defined class and call as parameter of a C++ function?"
Explanation:
I have a class in sources like "Creature" and I want to call a function from the sources inside a lua script, the function would be:
Code:
"sendCreatureStats(const Creature& creature)"
So, in my Lua script would look like this:
Code:
local function sendCreatureMove()
local creature = {} --Is this correct as a class?
creature.health = 100
creature.mana = 100
g_game.sendCreatureStats(creature)
end
So when I try to run this code, that returns me an error saying: "attempt to cast a lua number value to class Creature"
Help is appreciated !!
Thanks!!