Hetymine

Code worth dying for!

You are not logged in.


Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/toroadmin/hetymine/include/parser.php on line 802

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/toroadmin/hetymine/include/parser.php on line 802

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/toroadmin/hetymine/include/parser.php on line 802

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/toroadmin/hetymine/include/parser.php on line 802

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/toroadmin/hetymine/include/parser.php on line 802

#1 2010-07-27 18:41:12

duck-typing
The Programmer

Display and copy a random number

Download: rand.lua

Commands

rand <integer>
- A random number from 0 to <integer>

rand <integer> <integer>
- A random number from <integer> to <integer>

rand = {}

rand.execute = function (params)
    params = p.string.split(params, " ")
    params = p.table.removeempty(params)

    local r = 0

    p.math.randomize()

    if #params >= 2 then
        r = math.random(params[1], params[2])       
    elseif #params == 1 then
        r = math.random(0, params[1])
    else
        r = math.random()
    end

    p.clipboard.settext(r)
    exec.display(r, 1500)

    return true
end

Edited by duck-typing (2010-07-27 18:46:27)

Offline

Board footer

Powered by FluxBB