Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <title>Lua: Demo</title>
- <base href="https://www.lua.org/">
- <link rel="stylesheet" type="text/css" href="lua.css">
- <meta http-equiv="content-type" content="text/html; charset=utf-8">
- <style type="text/css">
- textarea {
- font-family: monoscape ;
- }
- input {
- margin-right: 1em ;
- }
- </style>
- </head>
- <body data-new-gr-c-s-check-loaded="14.982.0">
- <h1>
- <a href="home.html">
- <img src="images/logo.gif" alt="Lua">
- </a>
- "
- Demo
- "
- </h1>
- <p>
- "
- Try Lua before
- "
- <a href="download.html>downloading</a>
- " it.
- Enter your Lua program
- or choose one of the demo programs below.
- "
- </p>
- <div class="menubar">
- <a href="cgi-bin/demo?hello">hello</a>
- "
- .
- "
- <a href="cgi-bin/demo?bisect">bisect</a>
- "
- .
- "
- <a href="cgi-bin/demo?sieve">sieve</a
- "
- .
- "
- <a href="cgi-bin/demo?account">account</a>
- </div>
- <p>
- </p>
- <form action="cgi-bin/demo" method="POST">
- <textarea rows="16" cols="80" name="input" maxlength="2000">
- "function getdata()
- levels = {}
- djinn = {0, 0, 0, 0}
- events = 0
- stats = {}
- items = {}
- coins = 0
- eventflags = {0x941, 0x951, 0x8B3, 0x8D1, 0x81E, 0x868}
- for j=0,5 do
- index = eventflags[j+1]
- bytepos = bit.rshift(index, 3)
- bitpos = bit.band(index, 7)
- flag = bit.band(bit.rshift(memory.readbyte(0x02000040 + bytepos), bitpos), 1)
- events = bit.bor(events, bit.lshift(flag, j))
- end
- coins = memory.readdword(0x02000250)
- for i=0,3 do
- base = 0x02000500 + 0x14C*i
- table.insert(levels, memory.readbyte(base + 0xF))
- for j=0,3 do
- djinn[j+1] = bit.bor(djinn[j+1], memory.readdword(base + 0xF8 + 4*j))
- end
- hp = memory.readword(base + 0x10)
- pp = memory.readword(base + 0x12)
- atk = memory.readword(base + 0x18)
- def = memory.readword(base + 0x1A)
- agi = memory.readword(base + 0x1C)
- lck = memory.readbyte(base + 0x1E)
- table.insert(stats, {hp, pp, atk, def, agi, lck})
- pcitems = {}
- for j=0,14 do
- table.insert(pcitems, memory.readword(base + 0xd8 + 2*j))
- end
- table.insert(items, pcitems)
- end
- return levels, djinn, events, stats, items, coins
- end
- function bitarray()
- function write(self, value, size, pos)
- pos = pos or #self.bits+1
- size = size or 1
- for i=1,size do
- self.bits[pos + i-1] = bit.band(bit.rshift(value, size-i), 1)
- end
- end
- function sub(self, min, max)
- if max == nil then return self.bits[min] or 0 end
- value = 0
- for i=0,max-min do
- value = 2*value + (self.bits[min+i] or 0)
- end
- return value
- end
- return {bits={}, write=write, sub=sub}
- end
- function getpassword(passwordtier, levels, djinn, events, stats, items, coins)
- passwordtier = passwordtier:lower()
- bits = bitarray()
- tmparray = bitarray()
- for i=4,1,-1 do tmparray:w"
- </textarea>
- <p>
- <input type="submit" value="run">
- <input type="button" value="clear" onClick="this.form.elements['input'].value=''">
- <input type="reset" value="restore">
- <input type="button" value="restart" onClick="window.location.href='/demo.html'">
- </p>
- </form>
- <h2>
- ::before
- "Output"
- </h2>
- <textarea rows="8" cols="80">input:69: function arguments expected near <eof>
- </textarea>
Add Comment
Please, Sign In to add comment