Noki Posted October 5, 2015 Posted October 5, 2015 function Player:test() outputDebugString(self:getName()) end How would I go about exporting something like this? There is another thread that mentions using loadstring, but that really only works if I want to import the class. However, since I'm using the existing player class (containing a table with all the player functions) how would I go about running this function from another resource?
xeon17 Posted October 11, 2015 Posted October 11, 2015 You could do something like this, function playerTest () return Player:test() end This gives you the possibility to export it. But i'm pretty sure this isn't that what you exactly want
RenanPG Posted October 11, 2015 Posted October 11, 2015 You could do something like this, function playerTest () return Player:test() end This gives you the possibility to export it. But i'm pretty sure this isn't that what you exactly want function playerTest (p) return p:test() end
Banex Posted October 11, 2015 Posted October 11, 2015 Example: function Player:getName() return self.name end function execute(fc,p) for k, v in pairs(Player) do if k == fc then return v(p) end end end local playerName = exports.playerClass:execute("getName",thePlayer) outputDebugString(playerName)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now