How to remove spaces from a string in Lua?

It works, you just have to assign the actual result/return value. Use one of the following variations: str = str:gsub(“%s+”, “”) str = string.gsub(str, “%s+”, “”) I use %s+ as there’s no point in replacing an empty match (i.e. there’s no space). This just doesn’t make any sense, so I look for at least one … Read more

Lua vs Embedded Lisp and potential other candidates. for set based data processing

I strongly agree with @jpjacobs’s points. Lua is an excellent choice for embedding, unless there’s something very specific about lisp that you need (for instance, if your data maps particularly well to cons-cells). I’ve used lisp for many many years, BTW, and I quite like lisp syntax, but these days I’d generally pick Lua. While … Read more

What are Lua coroutines even for? Why doesn’t this code work as I expect it?

Coroutines aren’t threads. Coroutines are like threads that are never actively scheduled. So yes you are kinda correct that you would have to write you own scheduler to have both coroutines run simultaneously. However you are missing the bigger picture when it comes to coroutines. Check out wikipedia’s list of coroutine uses. Here is one … Read more

current line number in Lua

From Lua using debug.getinfo, e.g., local line = debug.getinfo(1).currentline From C using lua_getinfo (This will return the linenumber inside lua code) lua_Debug ar; lua_getstack(L, 1, &ar); lua_getinfo(L, “nSl”, &ar); int line = ar.currentline http://www.lua.org/manual/5.1/manual.html#lua_getinfo http://www.lua.org/manual/5.1/manual.html#pdf-debug.getinfo

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)