module

Lua::StackMixin::Chunk

Instance methods

run(buff : String, name : String | Nil = nil)

Evaluates a Lua chunk and returns the result if any. You can set the name of your chunk using name var.

Stack.new.run %q{
  double = function (x)
    return x * 2
  end

  return double(double(2))
} # => 8
Source
run(lua_file : File)

Evaluates a Lua chunk in a file and returns the result if any.

Stack.new.run File.new("./sample.lua")
Source