Skip to content

ScriptContext Api

qtiuto edited this page Dec 28, 2018 · 2 revisions

Java doc is here

  • constructor:see Module name in lua and proxy

  • compile:return a Compiled Script you can pass to run

  • run:run a script with several arguments,and all it returned is stored in an Object[] and values are converted the same as object() function with no type provided

  • changeCallSite: change the method you wish the lua function to agent,so that it can accept proper arguments and you can receive proper result.

  • putTableConverter:put a converter to support automatic table conversion

  • putIndexer:put an indexer to support index or new index operation

  • putIteratorFactory:put an iterator factory to generate a proper iterator

    e.g.

     import com.oslorde.luadroid.*;
     ScriptContext context=new ScriptContext();
     Object[] results = context.run("print 'Hello World'");