Results 1 to 9 of 9

Thread: LUA: How to get a table name

Threaded View

  1. #6
    Join Date
    Dec 2014
    Posts
    1

    Default

    you can print the pointer of a table by using metatables and metamethods like
    Code:
    myTable = setmetatable( {} , {__tostring = function() return "myTable" end} )

    then:
    Code:
     myTable.hello=function(self)
      print('hello, my name is '..tostring(self))
    end
    and
    Code:
    myTable:hello()
    should return "hello, my table is myTable"
    Last edited by Morphix; December 13th, 2014 at 06:54 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •