PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
def install(package):
__import__('os').system("pip -qqq install --upgrade pip")
__import__('os').system("pip install -qq --target='/usercode' " + package)
install("lupa")
import lupa
from lupa import LuaRuntime
lua = LuaRuntime(unpack_returned_tuples=True)
lua_code = '''
local my_array = {10, 20, 30, 40, 50}
-- Helper function to print the array, handling nil values
local function print_array(arr)
local str = "{"
for i = 1, #arr do
if arr[i] ~= nil then
str = str .. tostring(arr[i]) -- Convert to string if needed
if i < #arr then
str = str .. ", "
end
else
str = str .. "nil"
if i < #arr then
str = str .. ", "
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run