Hello everyone.
An application we are working on needs some parts to be scripted. The scripts will only act as callbacks to controle some part of the execution of some transactions. To do so, it must expose a few objects from the host application. The lifetime of these objects is well controled by the host and they will outlive the execution of the script. The logical choice seems to be the use of lightuser data.
We have exposed these objects using functions and lightuser data and it does work. However, lightuser data don't have their individual metatable. Instead, they all share the same so they all share the same metamethods. It would be great though if we could associate specific methods to each object exposed (like it can be done with full user data) so it would be possible to use object oriented programming notations on those objects from the script.
At the moment, we have to use a notation like this :
function f(user, logger)
setName(user, "name")
setGroup(user, "group")
output(logger, "User is set.")
end
instead of
function f(user, logger)
user:setName("name")
user:setGroup("group")
logger:output("User is set.")
end
Is there a way to do this with lightuser data ?