Jump to content

get methods and variables of element


Recommended Posts

since Vehicle is a lua table, you can for-loop it and you'll get all the functions as values, and function names as keys.

local funcnames = {} --set up a table to store the names of the functions
for k, v in pairs(Vehicle) do --loop all of the methods in Vehicle table
  if type(v) == "function" then --make sure this is a function, not a variable
    table.insert(funcnames, k) --add the function name to the new table
  end
end
local list = table.concat(funcnames, ", ") --concatenate all of the names in the table into a comma seperated list
local truncated = list:sub(1,100) --truncated so it doesn't exceed chatbox message limit
outputChatBox(truncated)

 

Edited by MrTasty
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...