C# PowerShell和LuaInterface.dll
这是一个关于c的例子# 我是新手。如何正确调用此dll? 我试着这样做:C# PowerShell和LuaInterface.dll,c#,.net,powershell,lua,C#,.net,Powershell,Lua,这是一个关于c的例子# 我是新手。如何正确调用此dll? 我试着这样做: [System.Reflection.Assembly]::LoadFile("E:\\lua\\LuaInterface.dll") $Lua = new-object LuaInterface.Lua # Here IntelliSense see class lua after dot $lua.DoString("local a=5") # Here IntelliSense see all m
[System.Reflection.Assembly]::LoadFile("E:\\lua\\LuaInterface.dll")
$Lua = new-object LuaInterface.Lua # Here IntelliSense see class lua after dot
$lua.DoString("local a=5") # Here IntelliSense see all methods after dot
这是:
Add-Type -path "E:\lua\LuaInterface.dll"
[LuaInterface.Lua]::DoString("local a=5")
但没有成功。请给我看看LuaInterface的“3+2”的例子
来自类LuaPS的方法不知何故无法看到。
在powershell上可以看到来自luaDLL类的方法。但是总是需要另外一个参数luastate您真的很接近了,但是
:
仅用于静态成员访问
我在32位控制台(PowerShell 5.1)中实现了以下功能:
“未成功”-这是什么意思?Lua的意外结果?抛出错误?如果是这样,哪些错误?首先,类luaps中的方法不知何故看不到。来自luaDLL的方法需要luastate作为第一个参数,但我不知道应该把它放在哪里。Mathias R.Jessen,谢谢,这很有效!请告诉我,如何从LuaDLL类运行lua_dostring($luaState,“os.execute('notepad.exe'))?为什么它只能在32位控制台上工作?
# Load LuaInterface
Add-Type -Path path\to\luainterface.dll
# Create Lua instance
$lua = [LuaInterface.Lua]::new()
# Set global variable values
$lua['a'] = 2
$lua['b'] = 3
# return result of `a+b`
$lua.DoString("return a+b")