Questions tagged [lua-5.2]

Some new features are yieldable pcall and metamethods, new lexical scheme for globals, ephemeron tables, finalizers for tables etc.

Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.

Lua 5.2 was released on 16 Dec 2011. More info on Lua's version history can be checked here. A list of new features in Lua 5.2 is as follows:

  • Yieldable pcall and metamethods.
  • New lexical scheme for globals.
  • Ephemeron tables.
  • New library for bitwise operations.
  • Light C functions.
  • Emergency garbage collector.
  • goto statement.
  • Finalizers for tables.
69 questions
1
vote
1 answer

Lua script wont accept args

I was trying to get an hologram projector working, but in run into these errors: bad arguments #3 (number expected, got no value) My script is: local component = require("component") local hologram = component.hologram function setVoxel(x, y, z,…
F. Linnenberg
  • 42
  • 1
  • 4
1
vote
1 answer

"require" not work in embeded lua

in this code i load and run test.lua file int main (){ L = luaL_newstate(); luaL_openlibs(L); luaL_dofile(L, "test.lua"); lua_close(L); return 0; } my test.lua file contents print ("s1"); r=require 'simple'; print ("s2"); the…
Baba
  • 852
  • 1
  • 17
  • 31
1
vote
2 answers

C++ Calling function from Lua script

I'm trying to bind Lua in my applications, now I trying to test how bind Lua into C++. My problem is very strange because I want to call function main() from script at start, after luaL_loadfile. My code: #include #include…
zbigniewcebula
  • 1,610
  • 2
  • 12
  • 9
1
vote
1 answer

Lua c-api: How to identify the coroutine/thread involved in a lua_pushcclosure callback?

Is there a way to know which thread (coroutine) executing a Lua script is at the origin of a lua_pushcclosure call? In order to manage some stuff relative to lua threads (delayed pause/resume, or private thread variables) I need to identify the…
Valkea
  • 1,216
  • 1
  • 12
  • 26
1
vote
1 answer

UPDATE cell value if a pair matches

I am using luasql. I have two tables of this type: IPINFO CREATE TABLE `ipstats` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `ip` VARCHAR(15) NOT NULL, `last_used` DATETIME NOT NULL DEFAULT '1981-09-30 00:00:00', PRIMARY KEY (`id`), …
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
1
vote
1 answer

how do we display an image/color in lua

I am having this problem, and I am not able to figure out the solution. I wish to display an image in some window if possible(not necessary tough), and then move it across the page by sending events from keyboard. The problem is I can't use LÖVE…
ashutosh
  • 79
  • 3
  • 8
0
votes
1 answer

How can I tell if a string starts with an emoji or not in Lua 5.2?

I know trying to deal with emojis in a string can get complicated in some cases, but in case I only wanted to know if a string starts with an emoji (any) or not, is there an easy way? Sorry if it finally turned to be a very basic question, but the…
Rai
  • 314
  • 1
  • 2
  • 9
0
votes
2 answers

Is there a way CMD can open a folder with an emoji in its name by using os.execute in Lua 5.2?

As soon as I try to access a folder/file containing an emoji in its name from my Lua 5.2 script, for example like this: os.execute('start "" "' .. path .. "\\scripts\\menu\\ My Scripts" .. '"') The Windows' Command Prompt simply refuses to open it…
Rai
  • 314
  • 1
  • 2
  • 9
0
votes
0 answers

What are my chances to get some basic web interaction from a program using Lua for scripts extensibility?

I'm very lost with this matter, so sorry if I'm asking for something too obvious or something, but I've been trying to get some low level info about it and, for what I've seen till now, I wouldn't even know where to start... Anyway, the case is I'm…
Rai
  • 314
  • 1
  • 2
  • 9
0
votes
1 answer

Avoid loading the same script twice with rFSM library in LUA

PROBLEM DESCRIPTION The following code is a minimal example that replicates a problem I am having. The rFSM library is used, which can be found here: https://github.com/kmarkus/rFSM There are three lua scripts. The "main", called runscript.lua,…
AngelosFr
  • 115
  • 1
  • 9
0
votes
0 answers

Is there a getattr or a property getter for userdata

I am trying to get a property of a userdata object. Similair to getattr in many other languages. Say for variable obj which is a userdata object I want to get a property, but that property is in a variable someVar. Meaning I can't use obj[someVar]…
Jab
  • 26,853
  • 21
  • 75
  • 114
0
votes
2 answers

How to create table entries with unique id and access them using that id..?

Hi I need to create a table in lua with each entry(record) can be represented by unique id table[p1d2].seq={0,1,2,3} table[p1d2].days={'sun','mon','wed'} table[p2d2].seq={0,1,2,3,4}…
Abhi
  • 73
  • 8
0
votes
1 answer

Is there a way to catch the output in lua?

I'm trying to catch the output from for example: print('Hello') and store it in a variable / table. Please let me know if this is even possible. If not thanks for answering.
TritriGuy123
  • 31
  • 1
  • 6
0
votes
1 answer

LUA 5.2: Load/Require/etc - Limit it to specific directories that can be loaded

I am attempting to secure LUA on my game (players can create scripts in LUA). I've removed many functions to create a sandbox of sorts, (AKA removing os.execute function for example.) however, my game does use loading of scripts from other locations…
Valleriani
  • 193
  • 11
0
votes
0 answers

Lua Copas: Sender coroutine just stops working

I have a problem using latest Copas in Lua 5.2. I wrote a simple script (see below) which creates two server sockets: "RX" and "TX". "RX" listens for messages from connected clients, "TX" transmits those messages to clients connected to "TX". The…
arngineer
  • 105
  • 1
  • 1
  • 8