What im having problem is that it seems like i cant overload my class specific functions in lua.
thi is my item struct:
Code: Select all
struct item
{
string name; //name of the item
bool hasOwner;
player* Owner; //owner of the item
Use(){} //this is the function i want to overload in lua
item(string _name)
{
hasOwner = false;
Owner = NULL;
name = _name;
}
};
Code: Select all
item_n0 = item("my item");
function item_n0:Use()
if(hasOwner == true)
Owner:SetHP(100);
end
end
Code: Select all
luabind::module(LuaState)
[
luabind::class_<item>("item")
.def(luabind::constructor<string>())
.def_readwrite("name",&item::name)
.def_readwrite("Owner",&item::Owner)
.def("Use",&item::Use)
];
I know it is possible because i have seen it in a lua file for garrysmod, and it uses luabind i heard.
so if anyone knows anyhing and can help me I would be very happy :D