Why do we need an embeddable programming language like Lua?

Since you tagged the question as “Lua”, I’ll give you an answer in the context of this language. Introduction Lua is written in C (almost completely compatible with C89 standard; the incompatible features can be easily disabled, if needed, using compile-time switches) and has been designed to be easily integrated with C code. In the … Read more

Are there any recent Lua to JavaScript converters or interpreters somewhere? [closed]

A new challenger appears: Lua.js https://github.com/mherkender/lua.js For some awesome demos proving its maturity, see https://github.com/ghoulsblade/love-webplayer Lua.js works by converting Lua code directly to ECMAscript (including JavaScript, ActionScript), which gives it an important speed advantage over solutions which attempt to implement the Lua VM in JavaScript.

What is the maximum value of a number in Lua?

as compiled by default, the Number is a double, on most compilers that’s an IEEE 64-bit floating point. that means 10bit exponent, so the maximum number is roughly 2^1024, or 5.6e300 years. that’s a long time. now, if you’re incrementing it, you might be more interested in the integer range. the 52-bit mantissa means that … Read more

Cross platform/compiler consistent sprintf of floating point numbers

You can switch to LuaJIT. It formats numbers consistently between platforms. From the extensions page: tostring() etc. canonicalize NaN and ±Inf All number-to-string conversions consistently convert non-finite numbers to the same strings on all platforms. NaN results in “nan”, positive infinity results in “inf” and negative infinity results in “-inf”. tonumber() etc. use builtin string … Read more

Node.js for lua?

A recent corresponding project is Luvit “(Lua + libUV + jIT = pure awesomesauce)”. From the announcement: this is basically luajit2 + libuv (the event loop library behind nodejs). It compiles as a single executable just like nodejs and can run .lua files. What makes it different from the stock luajit distribution is it has … Read more

How to create include files in Lua language?

require “header” See the require entry in the Lua Reference manual. The file “header.lua” must be somewhere in Lua’s search path. You can see (and modify) the path at package.path See the package.path entry in the the Lua Reference Manual This wiki page describes ways of creating modules to load with require.

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