lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Bertrand Mansion once stated:
> For me, Lua is the ideal programming language to teach to children because
> it is easy to understand, has only a few keywords and data types, and more
> complex features like metatables and coroutines can be completely ignored.
> It also offers more freedom in syntax than Python.
> 
> I was trying to do some Lua programming with my son (in Love2D, a space
> invader game, he is 7) but I soon realized that the English keywords can
> make things more complex than necessary for a young French boy (same with
> other spoken languages).

  I covered this a bit on my blog (http://boston.conman.org/2008/01/04.1)
where I created the Swedish programming language Håstad that looks like:

	medan not_done
	börja
	  för x:= 1 till 5 gör
	  börja
	    om person^.age = 120 så
	      too_old(person);
	    om person^.age > 130 så
	      gåtill person_should_be_dead;
	  slut;
	slut;

  I thought I might try at least converting 'if' and 'then' into Swedish
(since I had the words [1]) in Lua 5.3.  I had mixed results.

  I changed luaX_tokens[] so that 'if' became 'om' and 'then' became 'så'. 
I then tried [2]:

	Lua 5.3.0  Copyright (C) 1994-2015 Lua.org, PUC-Rio
	> x = 3
	> om x == 3 så print("hello") end
	stdin:1: 'så' expected near 's'

  When I changed 'så' to 'sa' and ran the same fragment:

	Lua 5.3.0  Copyright (C) 1994-2015 Lua.org, PUC-Rio
	> x = 3
	> om x == 3 sa print("hello") end
	hello

  I did try changing my locale and try using 'så' again but:

	[spc]lucy:/tmp/lua-5.3>echo $LANG
	se_NO.UTF-8
	[spc]lucy:/tmp/lua-5.3>date
	bearjadat, čakčamánu 18. b. 2015 17:17:20 EDT
	[spc]lucy:/tmp/lua-5.3>./src/lua
	Lua 5.3.0  Copyright (C) 1994-2015 Lua.org, PUC-Rio
	> x = 3
	> om x == 3 så print("hello") end
	stdin:1: 'så' expected near 's'

  For accented characters you may have some more work to get this working.

  -spc (bjork bjork bjork)

[1]	I have this friend from Sweden see ... 

[2]	My language setting is en_US.UTF-8.