LuaInterface
这里是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 methods after dot这是:
Add-Type -path "E:\lua\LuaInterface.dll"
[LuaInterface.Lua]::DoString("local a=5")但没有成功。请给我看一下LuaInterface的“LuaInterface”的例子。
Lua PS类中的方法不知怎么看不见。在屏幕截图上,powershell可以看到来自luaDLL类的方法。但是,总是需要多一个参数luastate。
发布于 2020-04-06 18:50:23
您非常接近,但是::只用于静态成员访问。
我在32位控制台(PowerShell 5.1)中完成了以下工作:
# 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")https://stackoverflow.com/questions/61051157
复制相似问题