Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #144 // Contents of Lua Sandbox

Lua code

assert(api)

print "Sandbox contents:\n"

names = {}
for k, v in api() do
  table.insert(names, k)
end

table.sort(names)

for _, name in ipairs(names) do
  print(name.." ("..type(api(name))..")")
end

Author comment

Prints the global functions available in the sandbox.

(Minus table.*, os.* and so on, but you can iterate over those tables normally.)

Script is provided as both a test and a reference. Click "test run" to see the actual contents of the sandbox.

test run  test run with input  download  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
290 #1000604 (pitcher) 2015-08-18 00:54:29
245 #1000610 (pitcher) Edit suggestion:
!636
!629

main {
static Object androidContext;
static String programID;

public static void main(String[] args) throws Exception {
assert(api)

print "Sandbox contents:\n"

names = {}
for k, v in api() do
table.insert(names, k)
end

table.sort(names)

for _, name in ipairs(names) do
print(name.." ("..type(api(name))..")")
end

}}
2015-08-18 00:52:44
13 stefan Fixed! 2014-01-19 07:42:37
12 stefan OK, something is weird in the debug output... the env-dependent API functions appear in "state" and not in "output". Apparently they go into the inner env which I think is kinda wrong. Should fix... 2014-01-19 04:52:55

add comment

Image recognition results

Recognizer Recognition Result Visualize Recalc
#308 215 [visualize]

Snippet ID: #144
Snippet name: Contents of Lua Sandbox
Eternal ID of this version: #144/1
Text MD5: 6e213b7707e8fd5c169520913497c31e
Author: stefan
Category: system utilities
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2014-02-01 15:11:13
Source code size: 215 bytes / 14 lines
Pitched / IR pitched: Yes / Yes
Views / Downloads: 1276 / 229
Referenced in: #3000382 - Answer for ferdie (>> t = 1, f = 0)