Questions tagged [lua-5.1]

The v5.1 of the Lua scripting language.

Lua is a powerful, fast, lightweight, embeddable scripting language.

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 is an extension programming language designed to support general procedural programming with data description facilities. It also offers good support for object-oriented programming, functional programming, and data-driven programming. Lua is intended to be used as a powerful, light-weight scripting language for any program that needs one. Lua is implemented as a library, written in clean C (that is, in the common subset of ANSI C and C++).

Being an extension language, Lua has no notion of a "main" program: it only works embedded in a host client, called the embedding program or simply the host. This host program can invoke functions to execute a piece of Lua code, can write and read Lua variables, and can register C functions to be called by Lua code. Through the use of C functions, Lua can be augmented to cope with a wide range of different domains, thus creating customized programming languages sharing a syntactical framework. The Lua distribution includes a sample host program called lua, which uses the Lua library to offer a complete, stand-alone Lua interpreter.

Lua is free software, and is provided as usual with no guarantees, as stated in its license. The implementation described in this manual is available at Lua's official web site.

70 questions
1
vote
2 answers

How to initialize table size in lua

What is the most efficient way to convert number to table? Or is it possible to make a table without loops? local t = 10 -- given number {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} -- result Update: the t variable is mutable number and I want to for each the…
jackson555
  • 31
  • 1
  • 4
1
vote
1 answer

Include lua scripts into executable

Hi this question seems to be answered but answers don't resolve my problem. I try to include lua script into executable by copying it into exe copy -b a.exe+test.lua output.exe but when i launch output.exe luaL_dofile() cannot find lua script. I…
dominicus
  • 13
  • 4
1
vote
1 answer

Luabind Undefined Symbols/ Luabind::scope::scope

I have just started working with Luabind, and have attempted to run the Hello World test specified at http://www.rasterbar.com/products/luabind/docs.html#calling-lua-functions. However, this provides an undefined symbol error when attempted to…
ayylmao
  • 13
  • 3
1
vote
1 answer

add variable value in table in lua for ptokax script

Recently i updated my ptokax to 0.5.3 and since then my votekick script has stopped working as in my script takes input from other online users as 1 or 2 as accept or deny the user to be kicked or not but now whenever the user enters 1 or 2 the…
warl0ck
  • 3,356
  • 4
  • 27
  • 57
1
vote
2 answers

Lua: Is decreasing iterator from inside of loop possible?

array={} size=10 math.randomseed(os.time()) for i=1,size do array[i]=math.random(size) if(i>1) then for j=1,i do if array[j]==array[i] then i=i-1 break end end …
hardpenguin
  • 159
  • 1
  • 2
  • 9
1
vote
1 answer

lua5.1 loop error end expected (to close 'while' )

no matter where I put the "end" it still gives me this error, lua: ch.lua:157: 'end' expected (to close 'while' at line 138) near ''>Exit code: 1 the code is here, function ch_handler() stopped = false while not err or stopped do res, err…
user3103366
  • 65
  • 1
  • 9
1
vote
0 answers

LUA 5.1 and python classes

You know how when your making a class in python you do, class className(object): def __init__(self): # INIT called first in a class my question is how would you do this in lua? Is there even classes in lua? If so what in Lua is like the…
user3103366
  • 65
  • 1
  • 9
1
vote
1 answer

Lua 5.1 setfenv() table still loading in global space

I've been trying to work with setfenv() in order to load a chunk into an environment outside of the global environment but I'm having a little trouble. The following is the code I'm running: -- main.lua function SandboxScript(scriptTable,…
OxCantEven
  • 629
  • 4
  • 9
0
votes
1 answer

about the lua version installed on armbian , it seems confusing

The armbian img is "Armbian_23.05.0_amlogic_s905l3a_bullseye_5.15.110_server_2023.05.02" I want use luasocket, but it is not support lua 5.4, so lua 5.1 was installed, however...... Which lua version installed? i want lua 5.1 only, and what can i…
0
votes
1 answer

error loading module 'ssl.core'; luaL_setfuncs: symbol not found

I want to use luasec package to construct a SSL call. I am doing this under Alpine 3.9. I have Lua 5.1, openssl-1.1.1k-r0 and openssl-dev-1.1.1k-r0. I install luasec by using "luarocks install luasec". The installation passed without error. But when…
0
votes
1 answer

My Lua 5.1 Implementation of the OPCODE TFORLOOP is not working correctly

I am working on a Lua 5.1 VM inside of Lua 5.1. Most Opcodes work fine but my TFORLOOP does not work. I get this error: Bad Argument #1 to '?' (table expected, got function) Here is my implementation of TFORLOOP: [33] = function(INSTRUCTION)…
0
votes
1 answer

Google Algorithm to encode polyline in lua5.1

I need to create lua script to encode polyline coordinates using google maps polyline encoding algorithm. This has to be for lua5.1 as the it is intended to be run inside Redis which is equipped with lua5.1. The following code is based on google…
Sami Al-Subhi
  • 4,406
  • 9
  • 39
  • 66
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
1 answer

Where should .dll files be placed when using lua5.1?

I am using lua5.1 and I have a devicecomm.dll library that I need to use. However, I'm not sure where this library should be placed. On Mac I know that the location should be under /usr/local/lib/lua/5.1 Does anyone know the equivalent location to…
Tom K
  • 11
  • 3
0
votes
0 answers

uint64 to hex in lua 5.1

Hey I am not able to make this conversion correctly. I use below code RawGUID=17379524724484210731 --It's impossible to store variable this way, it will always convert into test3 eventually. Stored as userdata I cannot…
Name Name
  • 23
  • 4