C# Class DynamicLua.LuaHelper

ファイルを表示 Open project: nrother/dynamiclua Class Usage Examples

Private Properties

Property Type Description
ExtractNativeDll void
ExtractNativeDlls void
LuaHelper System

Public Methods

Method Description
GetRandomString ( ) : string

Returns a random string with lenght LuaHelper.RandomNameLength. This can be safely used as a Lua Variable Name, but is not checked for collsions.

GetRandomString ( int lenght ) : string

Returns a random string with the specified lenght. Use the overload without paramters for the default length. This can be safely used as a Lua Variable Name, but is not checked for collsions.

see http://dotnet-snippets.de/dns/passwort-generieren-SID147.aspx

UnWrapObject ( object wrapped, NLua.Lua state, string name = null ) : object

Unwaps an object comming from LuaInterface for use in DynamicLua.

WrapObject ( object toWrap, NLua.Lua state, string name = null ) : object

Wraps an object to prepare it for passing to LuaInterface. If no name is specified, a random one with the default length is used.

Private Methods

Method Description
ExtractNativeDll ( string dllName ) : void

Extract the native DLL to the NativeDllPath

ExtractNativeDlls ( ) : void

This method extract the included native Lua-DLLs. It's important to extract the correct 32/64-bit version. We extract to %tmp%, we might not have write access to the current assembliy's locations. We append the path to the extracted DLLs to %PATH%, to make allow the system to find the DLL.

LuaHelper ( ) : System

Method Details

GetRandomString() public static method

Returns a random string with lenght LuaHelper.RandomNameLength. This can be safely used as a Lua Variable Name, but is not checked for collsions.
public static GetRandomString ( ) : string
return string

GetRandomString() public static method

Returns a random string with the specified lenght. Use the overload without paramters for the default length. This can be safely used as a Lua Variable Name, but is not checked for collsions.
see http://dotnet-snippets.de/dns/passwort-generieren-SID147.aspx
public static GetRandomString ( int lenght ) : string
lenght int
return string

UnWrapObject() public static method

Unwaps an object comming from LuaInterface for use in DynamicLua.
public static UnWrapObject ( object wrapped, NLua.Lua state, string name = null ) : object
wrapped object
state NLua.Lua
name string
return object

WrapObject() public static method

Wraps an object to prepare it for passing to LuaInterface. If no name is specified, a random one with the default length is used.
public static WrapObject ( object toWrap, NLua.Lua state, string name = null ) : object
toWrap object
state NLua.Lua
name string
return object