Diyacom Posted September 24, 2010 Share Posted September 24, 2010 Люди добрые подскажите как получить остаток от деления. Пробовал A%B и match.fmod(A, . Оба варианта вернули ошибки. Quote Link to comment Share on other sites More sharing options...
Nikon Posted September 24, 2010 Share Posted September 24, 2010 match.fmod то ли глючит то ли не работает в этой версии ЛУА X = Y - math.floor (Y) Quote Link to comment Share on other sites More sharing options...
SLA Posted September 24, 2010 Share Posted September 24, 2010 Не match.fmod, а math.mod() math.mod( 77, 10 ) -- остаток от деления 77 на 10. Quote Link to comment Share on other sites More sharing options...
Nikon Posted September 24, 2010 Share Posted September 24, 2010 А в справке fmod А mod вообще такой функции нет Quote Link to comment Share on other sites More sharing options...
SLA Posted September 24, 2010 Share Posted September 24, 2010 Да, точно, в официальных справках по Lua - math.fmod(). Возможно, есть 2 библиотеки math для Lua? Потому, что, как ни странно, в WoW'е было как и в АО - math.mod() - http://www.wowwiki.com/Lua_functions Quote Link to comment Share on other sites More sharing options...
Nikon Posted September 24, 2010 Share Posted September 24, 2010 А, ясно. У меня мануал по 5.1. Там сделали fmod, до этого был mod Покопался щас в инете http://www.lua.org/versions.html Quote: Lua 5.1 was released on 21 Feb 2006. The main features in Lua 5.1 are a new module system, incremental garbage collection, new mechanism for varargs, new syntax for long strings and comments, mod and length operators , metatables for all types, new configuration scheme via luaconf.h, and a fully reentrant parser. The current release is Lua 5.1.4, released on 22 Aug 2008. А я тоблин считал, как во 2-м посте написал Quote Link to comment Share on other sites More sharing options...
Recommended Posts