Extension:Scribunto/Lua 5.2 changes

From MediaWiki.org
Jump to: navigation, search

This page documents changes in Lua 5.2 that may be of interest to those writing code for Lua 5.1. These may cause problems for reusers using Scribunto in unsupported configurations, and may be problematic if Scribunto is ever changed to use Lua 5.2 or later.

Known issues[edit]

Issue Replacement
string.gfind deprecated in 5.1, removed in 5.2 Renamed to string.gmatch
math.log10 deprecated in 5.2 In 5.2, use math.log with base 10
math.mod deprecated in 5.1, removed in 5.2 Renamed to math.fmod
table.maxn deprecated in 5.2 No replacement
table.getn deprecated in 5.1, removed in 5.2 Use the length operator (#) instead
automatic arg variable in varargs function deprecated in 5.1, removed in 5.2 Use the varargs operator (...) instead
tonumber only works with integers when base 10 is explicitly specified in 5.2 If non-integers need to be recognized, specify nil or omit the base

External links[edit]