[Ipe-discuss] Checking HOSTNAME in an ipelet

Dmitriy Morozov ipe at foxcub.org
Tue Nov 9 00:16:36 CET 2010


I know nothing about Lua, so this question is probably stupid, but
that just means someone can answer it easily.

I'm trying to customize window size and autosave_filename depending on
the HOSTNAME set in the environment. I have a my_prefs.lua ipelet that
tries to do something like

if os.getenv("HOSTNAME") == "cole" then
    prefs.window_size = { 2000, 1600 }
    prefs.autosave_filename = "..."
else
    prefs.autosave_filename = "..."
    prefs.window_size = { 1024, 768 }
end

but that gives an error: "attempt to index global 'os' (a nil value)".

How can I access the HOSTNAME variable from an ipelet?

Thanks.
Dmitriy



More information about the Ipe-discuss mailing list