Class: Rufus::Lua::Function

Inherits:
Object
  • Object
show all
Defined in:
lib/immunio/rufus_lua_ext/state.rb

Instance Method Summary collapse

Instance Method Details

#call_with_stack_reset(*args) ⇒ Object

If an argument fails to be converted for Lua, we end up leaking everything that was already pushed onto the stack for the call. Make sure we reset our stack.



147
148
149
150
151
152
153
154
# File 'lib/immunio/rufus_lua_ext/state.rb', line 147

def call_with_stack_reset(*args)
  begin
    call_without_stack_reset(*args)
  rescue
    Lib.lua_settop(@pointer, 0)
    raise
  end
end