module Lua::StackMixin::Chunk

Direct including types

Defined in:

lua/stack/chunk.cr

Instance Method Summary

Instance Method Detail

def 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

[View source]
def run(lua_file : File) #

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

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

[View source]