NLua.Lua Class Reference
Inheritance diagram for NLua.Lua:
Collaboration diagram for NLua.Lua:

Public Member Functions

 Lua ()
 
 Lua (LuaState lState)
 
void Close ()
 
LuaFunction LoadString (string chunk, string name)
 
LuaFunction LoadString (byte[] chunk, string name)
 
LuaFunction LoadFile (string fileName)
 
object[] DoString (byte[] chunk, string chunkName="chunk")
 Executes a Lua chunk and returns all the chunk's return values in an array. More...
 
object[] DoString (string chunk, string chunkName="chunk")
 Executes a Lua chunk and returns all the chunk's return values in an array. More...
 
object[] DoFile (string fileName)
 
double GetNumber (string fullPath)
 
string GetString (string fullPath)
 
LuaTable GetTable (string fullPath)
 
object GetTable (Type interfaceType, string fullPath)
 
LuaFunction GetFunction (string fullPath)
 
void RegisterLuaDelegateType (Type delegateType, Type luaDelegateType)
 
void RegisterLuaClassType (Type klass, Type luaClass)
 
void LoadCLRPackage ()
 
Delegate GetFunction (Type delegateType, string fullPath)
 
void NewTable (string fullPath)
 
Dictionary< object, object > GetTableDict (LuaTable table)
 
int SetDebugHook (EventMasks mask, int count)
 Activates the debug hook More...
 
int RemoveDebugHook ()
 Removes the debug hook More...
 
EventMasks GetHookMask ()
 Gets the hook mask. More...
 
int GetHookCount ()
 Gets the hook count More...
 
string GetLocal (LuaDebug luaDebug, int n)
 Gets the stack entry on a given level More...
 
string SetLocal (LuaDebug luaDebug, int n)
 Sets local (see lua docs) More...
 
string GetUpValue (int funcindex, int n)
 Gets up value (see lua docs) More...
 
string SetUpValue (int funcindex, int n)
 Sets up value (see lua docs) More...
 
object Pop ()
 Pops a value from the lua stack. More...
 
void Push (object value)
 Pushes a value onto the lua stack. More...
 
LuaFunction RegisterFunction (string path, MethodBase function)
 
LuaFunction RegisterFunction (string path, object target, MethodBase function)
 
virtual void Dispose ()
 

Properties

bool IsExecuting [get]
 True while a script is being executed More...
 
IEnumerable< string > Globals [get]
 An alphabetically sorted list of all globals (objects, methods, etc.) externally added to this Lua instance More...
 
object this[string fullPath] [get, set]
 

Events

EventHandler< HookExceptionEventArgsHookException
 Event that is raised when an exception occures during a hook call. More...
 
EventHandler< DebugHookEventArgsDebugHook
 Event when lua hook callback is called More...
 

Constructor & Destructor Documentation

◆ Lua() [1/2]

NLua.Lua.Lua ( )

◆ Lua() [2/2]

NLua.Lua.Lua ( LuaState  lState)

Member Function Documentation

◆ Close()

void NLua.Lua.Close ( )

◆ Dispose()

virtual void NLua.Lua.Dispose ( )
virtual

◆ DoFile()

object [] NLua.Lua.DoFile ( string  fileName)

◆ DoString() [1/2]

object [] NLua.Lua.DoString ( byte[]  chunk,
string  chunkName = "chunk" 
)

Executes a Lua chunk and returns all the chunk's return values in an array.

Parameters
chunkChunk to execute
chunkNameName to associate with the chunk. Defaults to "chunk".
Returns

◆ DoString() [2/2]

object [] NLua.Lua.DoString ( string  chunk,
string  chunkName = "chunk" 
)

Executes a Lua chunk and returns all the chunk's return values in an array.

Parameters
chunkChunk to execute
chunkNameName to associate with the chunk. Defaults to "chunk".
Returns

◆ GetFunction() [1/2]

LuaFunction NLua.Lua.GetFunction ( string  fullPath)

◆ GetFunction() [2/2]

Delegate NLua.Lua.GetFunction ( Type  delegateType,
string  fullPath 
)

◆ GetHookCount()

int NLua.Lua.GetHookCount ( )

Gets the hook count

Returns
see lua docs

<author>Reinhard Ostermeier</author>

◆ GetHookMask()

EventMasks NLua.Lua.GetHookMask ( )

Gets the hook mask.

Returns
hook mask

<author>Reinhard Ostermeier</author>

◆ GetLocal()

string NLua.Lua.GetLocal ( LuaDebug  luaDebug,
int  n 
)

Gets the stack entry on a given level

Parameters
levellevel
luaDebuglua debug structure
Returns
Returns true if level was allowed, false if level was invalid.

<author>Reinhard Ostermeier</author>

Gets info (see lua docs)

Parameters
whatwhat (see lua docs)
luaDebuglua debug structure
Returns
see lua docs

<author>Reinhard Ostermeier</author>

Gets local (see lua docs)

Parameters
luaDebuglua debug structure
nsee lua docs
Returns
see lua docs

<author>Reinhard Ostermeier</author>

◆ GetNumber()

double NLua.Lua.GetNumber ( string  fullPath)

◆ GetString()

string NLua.Lua.GetString ( string  fullPath)

◆ GetTable() [1/2]

LuaTable NLua.Lua.GetTable ( string  fullPath)

◆ GetTable() [2/2]

object NLua.Lua.GetTable ( Type  interfaceType,
string  fullPath 
)

◆ GetTableDict()

Dictionary<object, object> NLua.Lua.GetTableDict ( LuaTable  table)

◆ GetUpValue()

string NLua.Lua.GetUpValue ( int  funcindex,
int  n 
)

Gets up value (see lua docs)

Parameters
funcindexsee lua docs
nsee lua docs
Returns
see lua docs

<author>Reinhard Ostermeier</author>

◆ LoadCLRPackage()

void NLua.Lua.LoadCLRPackage ( )

◆ LoadFile()

LuaFunction NLua.Lua.LoadFile ( string  fileName)

Parameters
fileName
Returns

◆ LoadString() [1/2]

LuaFunction NLua.Lua.LoadString ( byte[]  chunk,
string  name 
)

Parameters
chunk
name
Returns

◆ LoadString() [2/2]

LuaFunction NLua.Lua.LoadString ( string  chunk,
string  name 
)

Parameters
chunk
name
Returns

◆ NewTable()

void NLua.Lua.NewTable ( string  fullPath)

◆ Pop()

object NLua.Lua.Pop ( )

Pops a value from the lua stack.

Returns
Returns the top value from the lua stack.

<author>Reinhard Ostermeier</author>

◆ Push()

void NLua.Lua.Push ( object  value)

Pushes a value onto the lua stack.

Parameters
valueValue to push.

<author>Reinhard Ostermeier</author>

◆ RegisterFunction() [1/2]

LuaFunction NLua.Lua.RegisterFunction ( string  path,
MethodBase  function 
)

◆ RegisterFunction() [2/2]

LuaFunction NLua.Lua.RegisterFunction ( string  path,
object  target,
MethodBase  function 
)

◆ RegisterLuaClassType()

void NLua.Lua.RegisterLuaClassType ( Type  klass,
Type  luaClass 
)

◆ RegisterLuaDelegateType()

void NLua.Lua.RegisterLuaDelegateType ( Type  delegateType,
Type  luaDelegateType 
)

◆ RemoveDebugHook()

int NLua.Lua.RemoveDebugHook ( )

Removes the debug hook

Returns
see lua docs

<author>Reinhard Ostermeier</author>

◆ SetDebugHook()

int NLua.Lua.SetDebugHook ( EventMasks  mask,
int  count 
)

Activates the debug hook

Parameters
maskMask
countCount
Returns
see lua docs. -1 if hook is already set

<author>Reinhard Ostermeier</author>

◆ SetLocal()

string NLua.Lua.SetLocal ( LuaDebug  luaDebug,
int  n 
)

Sets local (see lua docs)

Parameters
luaDebuglua debug structure
nsee lua docs
Returns
see lua docs

<author>Reinhard Ostermeier</author>

◆ SetUpValue()

string NLua.Lua.SetUpValue ( int  funcindex,
int  n 
)

Sets up value (see lua docs)

Parameters
funcindexsee lua docs
nsee lua docs
Returns
see lua docs

<author>Reinhard Ostermeier</author>

Property Documentation

◆ Globals

IEnumerable<string> NLua.Lua.Globals
get

An alphabetically sorted list of all globals (objects, methods, etc.) externally added to this Lua instance

Members of globals are also listed. The formatting is optimized for text input auto-completion.

◆ IsExecuting

bool NLua.Lua.IsExecuting
get

True while a script is being executed

◆ this[string fullPath]

object NLua.Lua.this[string fullPath]
getset

Event Documentation

◆ DebugHook

EventHandler<DebugHookEventArgs> NLua.Lua.DebugHook

Event when lua hook callback is called

Is only raised if SetDebugHook is called before.

<author>Reinhard Ostermeier</author>

◆ HookException

EventHandler<HookExceptionEventArgs> NLua.Lua.HookException

Event that is raised when an exception occures during a hook call.

<author>Reinhard Ostermeier</author>


The documentation for this class was generated from the following file: