blob: 98b11d96ff4c2c95f1a45e1f9bb8773b58a9cf59 [file] [log] [blame] [raw]
package li.cil.oc.util
import com.naef.jnlua.{JavaFunction, LuaState}
class ExtendedLuaState(val state: LuaState) {
def pushScalaFunction(f: (LuaState) => Int) = state.pushJavaFunction(new ExtendedLuaState.ScalaFunction(f))
}
object ExtendedLuaState {
implicit def extendLuaState(lua: LuaState) = new ExtendedLuaState(lua)
private class ScalaFunction(val f: (LuaState) => Int) extends JavaFunction {
override def invoke(state: LuaState) = f(state)
}
}