我使用sudo apt-get安装太棒了
我将我的rc.lua复制到~/..config/超棒,然后运行
lua rc.lua
我得到了以下错误:
lua: rc.lua:2: module 'awful' not found:
no field package.preload['awful']
no file '/usr/local/share/lua/5.2/awful.lua'
no file '/usr/local/share/lua/5.2/awful/ini
可以从C/C++中获取lua堆栈中的所有错误吗?这是我尝试过的
c++
int main()
{
lua_State* L = luaL_newstate();
luaL_openlibs(L);
if (luaL_loadfile(L, "LuaBridgeScript.lua"))
{
throw std::runtime_error("Unable to find lua file");
}
int error = lua_pcall(L, 0, 0, 0);
while (err
在这一段代码中,我得到了以下错误:
[ERROR] lua/entities/cook/init.lua:58: attempt to index global 'self' (a nil value)1. cooked - lua/entities/cook/init.lua:58
函数从第57行开始,当我删除第58行(local Pos = self.Entity:GetPos()时,它只为第61行提供相同的错误消息。
function cooked()
local Pos = self.Entity:GetPos()
local roll = math.r
在Lua中,我想选择数组的各个部分。下面的示例从第二个元素中选择
a = { 1, 2, 3}
print(a)
b = {}
for i = 2, table.getn(a) do
table.insert(b, a[i])
end
print(b)
在python a1: works中。Lua有类似的语法吗?
我将与结合使用。试图调试的问题。可以查看和检查码头集装箱的内容吗?
vagrant@dokku:~$ dokku logs dokku.me -t
/app/.profile.d/config_vars: line 3: /app/packages/lib/lua/5.1/?.so: No such file or directory
/app/.profile.d/config_vars: line 4: /app/packages/share/lua/5.1/?.lua: No such file or directory
/app/.profile.d/config_vars: line
所以我试着用lua语言做一种语言,我把“输出”一词替换为“打印”和一些更多的单词,但是如果有人输出(“输出”),它也会替换它。我怎样才能检查它是否在字符串中?代码:
output('trying to make a new language in lua')
output('\n')
local file = io.open(arg[1],"r")
local code = file:read "*a"
local filename = arg[1]
local function execute()
code = code
问题:我想开发一种像Lua这样的脚本语言,但您可以使用
if (paramters) {
codeToDo()
}
而不是
if parameters do
code_to_do()
end
但还没有找到一个好的教程,他们在互联网上。
参数:我希望它能够被解释,我还想用C#来实现它,这样它就能最容易地与它集成。
嗨,我正在努力学习Lua,我在玩语言,我来这里是为了学习这个代码块。
for i = 1, 4, 1
do
if(i == 2) then
break
undefinedFunction("print 1")
end
print("print 2")
end
这对于解释器来说很好,对于未定义的函数没有做任何事情。另一方面,如果我们让这个代码块像那样
for i = 1, 4, 1
do
if(i == 2) then
break
1
end
在显示网络速度方面,我有与创建带有零填充的Conky文本变量?完全相同的问题。不过,我正在向dzen2 2发出管道。似乎lua_parse在这个设置中不起作用。
我试过:
直接格式化字符串:${lua_parse format %2s ${downspeed re0}}
使用goto:${downspeed re0}${goto 100}
在~/.xmonad/conky_lua_script.lua中设置自定义函数:
function conky_format( format, number )
return string.format( format, conky_parse( n
考虑以下的Lua代码:
local util = {}
function util:foo(p)
print (p or "p is nil")
end
util.foo("Hello World")
util.foo(nil, "Hello World")
当我在lua控制台中运行这个程序时,我会得到以下结果:
p is nil
Hello World
有人能给我解释一下这种行为吗。
编辑I通过进行以下更改使代码工作:
local util = {}
function util.foo(p)
print (p or "p
我编写了简单的类来压缩数据。下面是:
LZWCompressor = {}
function LZWCompressor.new()
local self = {}
self.mDictionary = {}
self.mDictionaryLen = 0
-- ...
self.Encode = function(sInput)
self:InitDictionary(true)
local s = ""
local ch = ""
local len = string.len(sInput)
loc
试图获得一个私有Garry的Mod服务器,开始使用公开发布的代码(moat.gg GitHub)测试一些东西。使用MariaDB获得数据库设置,并在启动服务器时遇到错误,而这些错误是我自己找不到的。零线索什么是错的,为什么它没有连接和我遇到的错误以下永久,任何帮助都是感激的。
[moat_addons] addons/moat_addons/lua/system/app/core/datastore.lua:1: Couldn't load module
library! (The specified module could not be found.)
1. require
我最近从ScriptFodder购买了MaterialBoard。我正在编辑组列表,以便它将显示大写和未连字符的组名,因此它将看起来像"Head Admin“,而不是head-admin。到目前为止一切都正常,但一旦它开始在变量名中使用连字符,它就得出了错误的结论:
[ERROR] addons/materialboard/lua/matboard_config.lua:76: '}' expected (to close '{' at line 73) near '='
1. unknown - addons/materialb