Questions tagged [lua-5.3]

A lightweight multi-paradigm programming language designed as a scripting language with extensible semantics as a primary goal.

Lua (/ˈluːə/ LOO-ə, from Portuguese: lua [ˈlu.(w)ɐ] meaning moon; explicitly not "LUA") is a lightweight multi-paradigm programming language designed as a scripting language with extensible semantics as a primary goal. Lua is cross-platform since it is written in ANSI C.

Lua has a relatively simple C API.

Wikipedia: http://en.wikipedia.org/wiki/Lua_%28programming_language%29

49 questions
7
votes
1 answer

Lua format.string can't format float as decimal (%d) as of 5.3

I recently upgraded from Lua 5.2.3 to 5.3.1 but I noticed all my scripts that perform a string.format started failing if it tried to format a float using %d local anExampleString = string.format("Sample Number: %d",10.100000001) -- Fails on 5.3.1,…
Puddler
  • 2,619
  • 2
  • 17
  • 26
6
votes
1 answer

lua_Integer and lua_createtable (table size limit)

In Lua 5.3 table related functions in the C API receive and return lua_Integer. void lua_rawgeti (lua_State *L, int idx, lua_Integer n); void lua_rawseti (lua_State *L, int idx, lua_Integer n); lua_Integer luaL_len (lua_State *L, int index); But,…
Adam
  • 3,053
  • 2
  • 26
  • 29
4
votes
1 answer

How to keep an integral number float in Lua 5.3

print(2^62) print(2^63) print(2^64) In Lua 5.2, all numbers are doubles. The output of the above code is: 4.6116860184274e+18 9.2233720368548e+18 1.844674407371e+19 Lua 5.3 has support for integers and does automatic conversion between integer and…
Yu Hao
  • 119,891
  • 44
  • 235
  • 294
3
votes
1 answer

Zerobrane does not access environment

I am moving to Debian 10 from Ubuntu 20.04. Now Lua 5.3 is not finding my own modules using "require". Worked fine on Ubuntu before, I suspect I am missing something now... Pointers are most welcome! Thanks in ~/.bashrc I have copied from the…
hazefire
  • 51
  • 2
3
votes
0 answers

How can I decode the Lua 5.3 call stack from a memory dump?

I'm extending an application with an embedded Lua VM. My scripts sometimes cause it to crash, and I'd like to be able to make some sense out of the resulting crash dump (Windows). Is there already a way to decode the Lua call stack? I realize that…
mojo
  • 4,050
  • 17
  • 24
3
votes
1 answer

Set _ENV from C++ for string function

In my project I'm executing some lua functions contained in an XML file. I read the XML from C++, parse the code strings, execute them and get the result. All of the related questions I have found either used a dedicated .lua file or did it in Lua…
John Doe
  • 1,613
  • 1
  • 17
  • 35
3
votes
1 answer

Proper way to manage Lua light userdata

I have a void * to a C++ created object that I pass to Lua using lua_pushlightuserdata(). Lua can perform some actions on that light userdata by passing it to Lua CFunctions and retrieving it with lua_touserdata(). At some point in the future the…
Moop
  • 3,414
  • 2
  • 23
  • 37
3
votes
1 answer

String referencing

In my code I need to keep track of certain value (a string, always...) in a local. I'd like to know whether the run time will re-create or examinate this string after putting it in a local, on the official Lua 5.3 implementations. Any ideas? In this…
user5066707
3
votes
2 answers

How to build lua 5.3 with library "lfs"?

In my project, I build Lua5.1 with library "lfs"(https://github.com/keplerproject/luafilesystem) by adding lfs.c and lfs.h in Makefile of Lua, it works well. But after upgrading to lua5.3, it fails like this: $ lua test.lua lua: test.lua:1: module…
3
votes
0 answers

Lua 5.3 max variable name length

I'm doing a report about Lua 5.3 for the college and have a topic where I need talk about variable names. I already consulted the documentation, but the info that I need isn't there. What I want to know is how many characters a variable name can…
3
votes
0 answers

dofile works but call a stack traceback

main.lua dofile("example.lua") example.lua print "Hello World" results in: Hello World lua: main.lua:1: attempt to call a nil value stack traceback: main.lua:1: in main chunk [C]: in ? But I don't understand why?
nick_sheen
  • 69
  • 3
3
votes
2 answers

How to create Fibonacci sequence in Lua?

I wrote a small script that creates Fibonacci sequence and returns a sum of all even integers. function even_fibo() -- create Fibonacci sequence local fib = {1, 2} -- starting with 1, 2 for i=3, 10 do fib[i] = fib[i-2] + fib[i-1] end …
minerals
  • 6,090
  • 17
  • 62
  • 107
3
votes
1 answer

Metatable is not indexed, even though setmetatable is used

According to the Lua manual, setmetatable still works the same as in Lua 5.0. Yet for some reason, when I try this code in Lua 5.1.5 and 5.3.1, it appears that the metatable is not accessed: ClassTable = {} ClassTable.getString = function(self) …
stands2reason
  • 672
  • 2
  • 7
  • 18
3
votes
0 answers

How does Lua UTString ensure maximum alignment for strings?

I'm reading lua's (5.3.0) source code, and in lobject.h I found it using a strange method to manipulate string as follow: /* ** Header for string value; string bytes follow the end of this structure ** (aligned according to 'UTString'; see next). …
xuzhezhao
  • 103
  • 1
  • 7
3
votes
1 answer

How to print lld in Lua 5.3

string.format (formatstring, ···) Returns a formatted version of its variable number of arguments following the description given in its first argument (which must be a string). The format string follows the same rules as the ISO C function…
Sleepwom
  • 227
  • 6
  • 15
1
2 3 4