class Lua::Function

Defined in:

lua/object/function.cr

Instance Method Summary

Instance methods inherited from class Lua::Object

ref : Int32? ref, release(stack = @stack) release

Constructor methods inherited from class Lua::Object

new(stack : Stack, ref : Int32 | Nil) new

Instance Method Detail

def call(*args) #

Make a call to the Lua function.

s = Lua::Stack.new
sum = s.run(%q{
   function sum(x, y)
     return x + y
   end

   return sum
 }).as(Lua::Function)

sum.call(2, 3) # => 5.0

[View source]
def to_s(io) #

String representation of the function. Contains number of args and function Lua source.


[View source]